From a501b4ff46f5a67f40d616dc949ab38c0bf70415 Mon Sep 17 00:00:00 2001 From: Rado Kirov Date: Wed, 23 Sep 2015 16:52:42 -0700 Subject: [PATCH] adds 2.0.0-snapshot dir (manually updated for now) Built locally at https://github.com/angular/angular/commit/ce6b364dc5a1e60030382559c0d59b5b51532a8d --- 2.0.0-snapshot/angular2.dev.js | 29754 +++++++++++++++++++ 2.0.0-snapshot/angular2.js | 29366 +++++++++++++++++++ 2.0.0-snapshot/angular2.min.js | 29 + 2.0.0-snapshot/angular2.sfx.dev.js | 33335 ++++++++++++++++++++++ 2.0.0-snapshot/http.dev.js | 27435 ++++++++++++++++++ 2.0.0-snapshot/http.js | 28397 ++++++++++++++++++ 2.0.0-snapshot/http.min.js | 28 + 2.0.0-snapshot/http.sfx.dev.js | 27797 ++++++++++++++++++ 2.0.0-snapshot/router.dev.js | 2281 ++ 2.0.0-snapshot/router.dev.js.map | 1 + 2.0.0-snapshot/test_lib.dev.js | 2181 ++ 2.0.0-snapshot/test_lib.dev.js.map | 1 + 2.0.0-snapshot/web_worker/ui.dev.js | 28378 ++++++++++++++++++ 2.0.0-snapshot/web_worker/worker.dev.js | 30090 +++++++++++++++++++ 14 files changed, 239073 insertions(+) create mode 100644 2.0.0-snapshot/angular2.dev.js create mode 100644 2.0.0-snapshot/angular2.js create mode 100644 2.0.0-snapshot/angular2.min.js create mode 100644 2.0.0-snapshot/angular2.sfx.dev.js create mode 100644 2.0.0-snapshot/http.dev.js create mode 100644 2.0.0-snapshot/http.js create mode 100644 2.0.0-snapshot/http.min.js create mode 100644 2.0.0-snapshot/http.sfx.dev.js create mode 100644 2.0.0-snapshot/router.dev.js create mode 100644 2.0.0-snapshot/router.dev.js.map create mode 100644 2.0.0-snapshot/test_lib.dev.js create mode 100644 2.0.0-snapshot/test_lib.dev.js.map create mode 100644 2.0.0-snapshot/web_worker/ui.dev.js create mode 100644 2.0.0-snapshot/web_worker/worker.dev.js diff --git a/2.0.0-snapshot/angular2.dev.js b/2.0.0-snapshot/angular2.dev.js new file mode 100644 index 0000000000..b362008db5 --- /dev/null +++ b/2.0.0-snapshot/angular2.dev.js @@ -0,0 +1,29754 @@ +/** + @license +Copyright 2014-2015 Google, Inc. http://angularjs.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + */ + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchRequestAnimationFrame(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + + +/** + * requestAnimationFrame is typically recursively called from within the callback function + * that it executes. To handle this case, only fork a zone if this is executed + * within the root zone. + */ +function patchRequestAnimationFrame(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + global.zone[name] = function (fn) { + var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; + if (fn) { + arguments[0] = function () { + return callZone.run(fn, arguments); + }; + } + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchRequestAnimationFrame: patchRequestAnimationFrame, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (utils.isWebWorker()){ + // on WebWorker so don't apply patch + return; + } + + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (supportsWebSocket) { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + webSocketPatch.apply(); + } + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; +var utils = require("../utils"); + +function apply() { + if (utils.isWebWorker() || !('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function isWebWorker() { + return (typeof document === "undefined"); +} + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, handler) { + var fn; + //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (handler.toString() !== "[object FunctionWrapper]") { + if (handler.handleEvent) { + // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in + // IE9 by the arguments[1] assignment at end of this function. + fn = (function(handler) { + return function() { + handler.handleEvent.apply(handler, arguments); + }; + })(handler); + } else { + fn = handler; + } + + handler._fn = fn; + handler._bound = handler._bound || {}; + arguments[1] = handler._bound[eventName] = zone.bind(fn); + } + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, handler) { + if(handler._bound && handler._bound[eventName]) { + var _bound = handler._bound; + + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(handler._fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass, + isWebWorker: isWebWorker +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/profile", ["angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var profile_1 = require("angular2/src/core/profile/profile"); + exports.wtfCreateScope = profile_1.wtfCreateScope; + exports.wtfLeave = profile_1.wtfLeave; + exports.wtfStartTimeRange = profile_1.wtfStartTimeRange; + exports.wtfEndTimeRange = profile_1.wtfEndTimeRange; + global.define = __define; + return module.exports; +}); + +System.register("angular2/lifecycle_hooks", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/bootstrap", ["angular2/src/core/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var bootstrap_1 = require("angular2/src/core/bootstrap"); + exports.bootstrap = bootstrap_1.bootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +/** + @license + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015 Netflix, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/angular2", ["angular2/core", "angular2/profile", "angular2/lifecycle_hooks", "angular2/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/core")); + __export(require("angular2/profile")); + __export(require("angular2/lifecycle_hooks")); + __export(require("angular2/bootstrap")); + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=angular2.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/angular2.js b/2.0.0-snapshot/angular2.js new file mode 100644 index 0000000000..898da6d988 --- /dev/null +++ b/2.0.0-snapshot/angular2.js @@ -0,0 +1,29366 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchRequestAnimationFrame(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + + +/** + * requestAnimationFrame is typically recursively called from within the callback function + * that it executes. To handle this case, only fork a zone if this is executed + * within the root zone. + */ +function patchRequestAnimationFrame(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + global.zone[name] = function (fn) { + var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; + if (fn) { + arguments[0] = function () { + return callZone.run(fn, arguments); + }; + } + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchRequestAnimationFrame: patchRequestAnimationFrame, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (utils.isWebWorker()){ + // on WebWorker so don't apply patch + return; + } + + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (supportsWebSocket) { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + webSocketPatch.apply(); + } + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; +var utils = require("../utils"); + +function apply() { + if (utils.isWebWorker() || !('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function isWebWorker() { + return (typeof document === "undefined"); +} + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, handler) { + var fn; + //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (handler.toString() !== "[object FunctionWrapper]") { + if (handler.handleEvent) { + // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in + // IE9 by the arguments[1] assignment at end of this function. + fn = (function(handler) { + return function() { + handler.handleEvent.apply(handler, arguments); + }; + })(handler); + } else { + fn = handler; + } + + handler._fn = fn; + handler._bound = handler._bound || {}; + arguments[1] = handler._bound[eventName] = zone.bind(fn); + } + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, handler) { + if(handler._bound && handler._bound[eventName]) { + var _bound = handler._bound; + + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(handler._fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass, + isWebWorker: isWebWorker +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +/*! ***************************************************************************** +Copyright (C) Microsoft. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +"use strict"; +var Reflect; +(function (Reflect) { + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var _Map = typeof Map === "function" ? Map : CreateMapPolyfill(); + var _Set = typeof Set === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + var __Metadata__ = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param targetKey (Optional) The property key to decorate. + * @param targetDescriptor (Optional) The property descriptor for the target key + * @remarks Decorators are applied in reverse order. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * C = Reflect.decorate(decoratorsArray, C); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, C.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(C, "staticMethod", + * Reflect.decorate(decoratorsArray, C, "staticMethod", + * Object.getOwnPropertyDescriptor(C, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(C.prototype, "method", + * Reflect.decorate(decoratorsArray, C.prototype, "method", + * Object.getOwnPropertyDescriptor(C.prototype, "method"))); + * + */ + function decorate(decorators, target, targetKey, targetDescriptor) { + if (!IsUndefined(targetDescriptor)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + else if (IsUndefined(targetKey)) { + throw new TypeError(); + } + else if (!IsObject(targetDescriptor)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor); + } + else if (!IsUndefined(targetKey)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithoutDescriptor(decorators, target, targetKey); + } + else { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsConstructor(target)) { + throw new TypeError(); + } + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class C { + * } + * + * // property (on constructor, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class C { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class C { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, targetKey) { + if (!IsUndefined(targetKey)) { + if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + else { + if (!IsConstructor(target)) { + throw new TypeError(); + } + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); + } + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param targetKey (Optional) The property key for the target. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, C); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/profile", ["angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var profile_1 = require("angular2/src/core/profile/profile"); + exports.wtfCreateScope = profile_1.wtfCreateScope; + exports.wtfLeave = profile_1.wtfLeave; + exports.wtfStartTimeRange = profile_1.wtfStartTimeRange; + exports.wtfEndTimeRange = profile_1.wtfEndTimeRange; + global.define = __define; + return module.exports; +}); + +System.register("angular2/lifecycle_hooks", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/bootstrap", ["angular2/src/core/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var bootstrap_1 = require("angular2/src/core/bootstrap"); + exports.bootstrap = bootstrap_1.bootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/angular2", ["angular2/core", "angular2/profile", "angular2/lifecycle_hooks", "angular2/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/core")); + __export(require("angular2/profile")); + __export(require("angular2/lifecycle_hooks")); + __export(require("angular2/bootstrap")); + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=angular2.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/angular2.min.js b/2.0.0-snapshot/angular2.min.js new file mode 100644 index 0000000000..43d60d7962 --- /dev/null +++ b/2.0.0-snapshot/angular2.min.js @@ -0,0 +1,29 @@ +!function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[a]={exports:{}};t[a][0].call(u.exports,function(e){var r=t[a][1][e];return i(r?r:e)},u,u.exports,e,t,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a-1;if(a&&!s){var c=Promise.resolve();o._setScheduler(function(e){c.then(e)})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"es6-promise":15}],4:[function(e,t,r){(function(r){"use strict";function n(){i.patchSetClearFunction(r,["timeout","interval","immediate"]),i.patchRequestAnimationFrame(r,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame"]),i.patchFunction(r,["alert","prompt"]),l.apply(),u.apply(),o.apply(),a.patchClass("MutationObserver"),a.patchClass("WebKitMutationObserver"),s.apply(),c.apply(),p.apply()}var i=e("./functions"),o=e("./promise"),a=e("./mutation-observer"),s=e("./define-property"),c=e("./register-element"),l=(e("./websocket"),e("./event-target")),u=e("./property-descriptor"),p=e("./geolocation");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(e,t,r){"use strict";function n(){Object.defineProperty=function(e,t,r){if(o(e,t))throw new TypeError("Cannot assign to read only property '"+t+"' of "+e);return"prototype"!==t&&(r=a(e,t,r)),s(e,t,r)},Object.defineProperties=function(e,t){return Object.keys(t).forEach(function(r){Object.defineProperty(e,r,t[r])}),e},Object.create=function(e,t){return"object"==typeof t&&Object.keys(t).forEach(function(r){t[r]=a(e,r,t[r])}),l(e,t)},Object.getOwnPropertyDescriptor=function(e,t){var r=c(e,t);return o(e,t)&&(r.configurable=!1),r}}function i(e,t,r){return r=a(e,t,r),s(e,t,r)}function o(e,t){return e&&e.__unconfigurables&&e.__unconfigurables[t]}function a(e,t,r){return r.configurable=!0,r.configurable||(e.__unconfigurables||s(e,"__unconfigurables",{writable:!0,value:{}}),e.__unconfigurables[t]=!0),r}var s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.create;t.exports={apply:n,_redefineProperty:i}},{}],6:[function(e,t,r){(function(r){"use strict";function n(){if(r.EventTarget)i.patchEventTargetMethods(r.EventTarget.prototype);else{var e=["ApplicationCache","EventSource","FileReader","InputMethodContext","MediaController","MessagePort","Node","Performance","SVGElementInstance","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebKitNamedFlow","Window","Worker","WorkerGlobalScope","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];e.forEach(function(e){r[e]&&i.patchEventTargetMethods(r[e].prototype)})}}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],7:[function(e,t,r){(function(r){"use strict";function n(e,t){t.map(function(e){return e[0].toUpperCase()+e.substr(1)}).forEach(function(t){var n="set"+t,i=e[n];if(i){var o="clear"+t,a={},c="setInterval"===n?s.bindArguments:s.bindArgumentsOnce;r.zone[n]=function(t){var r,n=t;arguments[0]=function(){return delete a[r],n.apply(this,arguments)};var o=c(arguments);return r=i.apply(e,o),a[r]=!0,r},e[n]=function(){return r.zone[n].apply(this,arguments)};var l=e[o];r.zone[o]=function(e){return a[e]&&(delete a[e],r.zone.dequeueTask()),l.apply(this,arguments)},e[o]=function(){return r.zone[o].apply(this,arguments)}}})}function i(e,t){t.forEach(function(t){var n=e[t];n&&(r.zone[t]=function(t){var i=r.zone.isRootZone()?r.zone.fork():r.zone;return t&&(arguments[0]=function(){return i.run(t,arguments)}),n.apply(e,arguments)},e[t]=function(){return r.zone[t].apply(this,arguments)})})}function o(e,t){t.forEach(function(t){var n=e[t];n&&(r.zone[t]=function(t){var r=t;arguments[0]=function(){return r.apply(this,arguments)};var i=s.bindArgumentsOnce(arguments);return n.apply(e,i)},e[t]=function(){return zone[t].apply(this,arguments)})})}function a(e,t){t.forEach(function(t){var n=e[t];r.zone[t]=function(){return n.apply(e,arguments)},e[t]=function(){return r.zone[t].apply(this,arguments)}})}var s=e("../utils");t.exports={patchSetClearFunction:n,patchSetFunction:o,patchRequestAnimationFrame:i,patchFunction:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],8:[function(e,t,r){(function(r){"use strict";function n(){r.navigator&&r.navigator.geolocation&&i.patchPrototype(r.navigator.geolocation,["getCurrentPosition","watchPosition"])}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],9:[function(e,t,r){(function(e){"use strict";function r(t){var r=e[t];if(r){e[t]=function(t){this._o=new r(e.zone.bind(t,!0)),this._creationZone=e.zone};var n=new r(function(){});e[t].prototype.disconnect=function(){var e=this._o.disconnect.apply(this._o,arguments);return this._active&&(this._creationZone.dequeueTask(),this._active=!1),e},e[t].prototype.observe=function(){return this._active||(this._creationZone.enqueueTask(),this._active=!0),this._o.observe.apply(this._o,arguments)};var i;for(i in n)!function(r){void 0===typeof e[t].prototype&&("function"==typeof n[r]?e[t].prototype[r]=function(){return this._o[r].apply(this._o,arguments)}:Object.defineProperty(e[t].prototype,r,{set:function(t){this._o[r]="function"==typeof t?e.zone.bind(t):t},get:function(){return this._o[r]}}))}(i)}}t.exports={patchClass:r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(e,t,r){(function(r){"use strict";function n(e,t){var n=r,i=e.every(function(e){return n=n[e]});i&&t.forEach(function(e){var t=n[e];t&&(n[e]=a(t))})}function i(e){var t=e.then;e.then=function(){var r=s.bindArguments(arguments),n=t.apply(e,r);return i(n)};var r=e["catch"];return e["catch"]=function(){var t=s.bindArguments(arguments),n=r.apply(e,t);return i(n)},e}function o(){if(r.Promise){s.patchPrototype(Promise.prototype,["then","catch"]);var e=[[[],["fetch"]],[["Response","prototype"],["arrayBuffer","blob","json","text"]]];e.forEach(function(e){n(e[0],e[1])})}}var a,s=e("../utils");a=r.Promise?function(e){return function(){var t=e.apply(this,arguments);return t instanceof Promise?t:new Promise(function(e,r){t.then(e,r)})}}:function(e){return function(){return i(e.apply(this,arguments))}},t.exports={apply:o,bindPromiseFn:a}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],11:[function(e,t,r){(function(r){"use strict";function n(){if(!s.isWebWorker()){var e="undefined"!=typeof WebSocket;if(i()){var t=c.map(function(e){return"on"+e});s.patchProperties(HTMLElement.prototype,t),s.patchProperties(XMLHttpRequest.prototype),e&&s.patchProperties(WebSocket.prototype)}else o(),s.patchClass("XMLHttpRequest"),e&&a.apply()}}function i(){if(!Object.getOwnPropertyDescriptor(HTMLElement.prototype,"onclick")&&"undefined"!=typeof Element){var e=Object.getOwnPropertyDescriptor(Element.prototype,"onclick");if(e&&!e.configurable)return!1}Object.defineProperty(HTMLElement.prototype,"onclick",{get:function(){return!0}});var t=document.createElement("div"),r=!!t.onclick;return Object.defineProperty(HTMLElement.prototype,"onclick",{}),r}function o(){c.forEach(function(e){var t="on"+e;document.addEventListener(e,function(e){for(var n,i=e.target;i;)i[t]&&!i[t]._unbound&&(n=r.zone.bind(i[t]),n._unbound=i[t],i[t]=n),i=i.parentElement},!0)})}var a=e("./websocket"),s=e("../utils"),c="copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror".split(" ");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14,"./websocket":13}],12:[function(e,t,r){(function(r){"use strict";function n(){if(!o.isWebWorker()&&"registerElement"in r.document){var e=document.registerElement,t=["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"];document.registerElement=function(n,o){return o&&o.prototype&&t.forEach(function(e){if(o.prototype.hasOwnProperty(e)){var t=Object.getOwnPropertyDescriptor(o.prototype,e);t&&t.value?(t.value=r.zone.bind(t.value),i(o.prototype,e,t)):o.prototype[e]=r.zone.bind(o.prototype[e])}else o.prototype[e]&&(o.prototype[e]=r.zone.bind(o.prototype[e]))}),e.apply(document,[n,o])}}}var i=e("./define-property")._redefineProperty,o=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14,"./define-property":5}],13:[function(e,t,r){(function(r){"use strict";function n(){var e=r.WebSocket;i.patchEventTargetMethods(e.prototype),r.WebSocket=function(t,r){var n,o=arguments.length>1?new e(t,r):new e(t),a=Object.getOwnPropertyDescriptor(o,"onmessage");return a&&a.configurable===!1?(n=Object.create(o),["addEventListener","removeEventListener","send","close"].forEach(function(e){n[e]=function(){return o[e].apply(o,arguments)}})):n=o,i.patchProperties(n,["onclose","onerror","onmessage","onopen"]),n}}var i=e("../utils");t.exports={apply:n}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../utils":14}],14:[function(e,t,r){(function(e){"use strict";function r(t){for(var r=t.length-1;r>=0;r--)"function"==typeof t[r]&&(t[r]=e.zone.bind(t[r]));return t}function n(t){for(var r=t.length-1;r>=0;r--)"function"==typeof t[r]&&(t[r]=e.zone.bindOnce(t[r]));return t}function i(e,t){t.forEach(function(t){var n=e[t];n&&(e[t]=function(){return n.apply(this,r(arguments))})})}function o(){return"undefined"==typeof document}function a(e,t){var r=Object.getOwnPropertyDescriptor(e,t)||{enumerable:!0,configurable:!0};delete r.writable,delete r.value;var n=t.substr(2),i="_"+t;r.set=function(e){this[i]&&this.removeEventListener(n,this[i]),"function"==typeof e?(this[i]=e,this.addEventListener(n,e,!1)):this[i]=null},r.get=function(){return this[i]},Object.defineProperty(e,t,r)}function s(e,t){(t||function(){var t=[];for(var r in e)t.push(r);return t}().filter(function(e){return"on"===e.substr(0,2)})).forEach(function(t){a(e,t)})}function c(t){var r=t.addEventListener;t.addEventListener=function(e,t){var n;return"[object FunctionWrapper]"!==t.toString()&&(n=t.handleEvent?function(e){return function(){e.handleEvent.apply(e,arguments)}}(t):t,t._fn=n,t._bound=t._bound||{},arguments[1]=t._bound[e]=zone.bind(n)),r.apply(this,arguments)};var n=t.removeEventListener;t.removeEventListener=function(t,r){if(r._bound&&r._bound[t]){var i=r._bound;arguments[1]=i[t],delete i[t]}var o=n.apply(this,arguments);return e.zone.dequeueTask(r._fn),o}}function l(t){var n=e[t];if(n){e[t]=function(){var e=r(arguments);switch(e.length){case 0:this._o=new n;break;case 1:this._o=new n(e[0]);break;case 2:this._o=new n(e[0],e[1]);break;case 3:this._o=new n(e[0],e[1],e[2]);break;case 4:this._o=new n(e[0],e[1],e[2],e[3]);break;default:throw new Error("what are you even doing?")}};var i,o=new n;for(i in o)!function(r){"function"==typeof o[r]?e[t].prototype[r]=function(){return this._o[r].apply(this._o,arguments)}:Object.defineProperty(e[t].prototype,r,{set:function(t){this._o[r]="function"==typeof t?e.zone.bind(t):t},get:function(){return this._o[r]}})}(i);for(i in n)"prototype"!==i&&n.hasOwnProperty(i)&&(e[t][i]=n[i])}}t.exports={bindArguments:r,bindArgumentsOnce:n,patchPrototype:i,patchProperty:a,patchProperties:s,patchEventTargetMethods:c,patchClass:l,isWebWorker:o}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(e,t,r){(function(r,n){(function(){"use strict";function i(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){z=e}function c(e){Q=e}function l(){var e=r.nextTick,t=r.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=setImmediate),function(){e(h)}}function u(){return function(){q(h)}}function p(){var e=0,t=new Z(h),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=h,function(){e.port2.postMessage(0)}}function f(){return function(){setTimeout(h,1)}}function h(){for(var e=0;$>e;e+=2){var t=te[e],r=te[e+1];t(r),te[e]=void 0,te[e+1]=void 0}$=0}function g(){try{var t=e,r=t("vertx");return q=r.runOnLoop||r.runOnContext,u()}catch(n){return f()}}function m(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function y(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return oe.error=t,oe}}function b(e,t,r,n){try{e.call(t,r,n)}catch(i){return i}}function w(e,t,r){Q(function(e){var n=!1,i=b(r,t,function(r){n||(n=!0,t!==r?P(e,r):x(e,r))},function(t){n||(n=!0,S(e,t))},"Settle: "+(e._label||" unknown promise"));!n&&i&&(n=!0,S(e,i))},e)}function C(e,t){t._state===ne?x(e,t._result):t._state===ie?S(e,t._result):D(t,void 0,function(t){P(e,t)},function(t){S(e,t)})}function E(e,t){if(t.constructor===e.constructor)C(e,t);else{var r=_(t);r===oe?S(e,oe.error):void 0===r?x(e,t):o(r)?w(e,t,r):x(e,t)}}function P(e,t){e===t?S(e,v()):i(t)?E(e,t):x(e,t)}function R(e){e._onerror&&e._onerror(e._result),I(e)}function x(e,t){e._state===re&&(e._result=t,e._state=ne,0!==e._subscribers.length&&Q(I,e))}function S(e,t){e._state===re&&(e._state=ie,e._result=t,Q(R,e))}function D(e,t,r,n){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+ne]=r,i[o+ie]=n,0===o&&e._state&&Q(I,e)}function I(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var n,i,o=e._result,a=0;aa;a++)D(n.resolve(e[a]),void 0,t,r);return i}function V(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(m);return P(r,e),r}function j(e){var t=this,r=new t(m);return S(r,e),r}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function F(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function W(e){this._id=de++,this._state=void 0,this._result=void 0,this._subscribers=[],m!==e&&(o(e)||L(),this instanceof W||F(),M(this,e))}function U(){var e;if("undefined"!=typeof n)e=n;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=e.Promise;(!r||"[object Promise]"!==Object.prototype.toString.call(r.resolve())||r.cast)&&(e.Promise=fe)}var H;H=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var q,z,K,G=H,$=0,Q=({}.toString,function(e,t){te[$]=e,te[$+1]=t,$+=2,2===$&&(z?z(h):K())}),X="undefined"!=typeof window?window:void 0,Y=X||{},Z=Y.MutationObserver||Y.WebKitMutationObserver,J="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);K=J?l():Z?p():ee?d():void 0===X&&"function"==typeof e?g():f();var re=void 0,ne=1,ie=2,oe=new O,ae=new O;N.prototype._validateInput=function(e){return G(e)},N.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},N.prototype._init=function(){this._result=new Array(this.length)};var se=N;N.prototype._enumerate=function(){for(var e=this,t=e.length,r=e.promise,n=e._input,i=0;r._state===re&&t>i;i++)e._eachEntry(n[i],i)},N.prototype._eachEntry=function(e,t){var r=this,n=r._instanceConstructor;a(e)?e.constructor===n&&e._state!==re?(e._onerror=null,r._settledAt(e._state,t,e._result)):r._willSettleAt(n.resolve(e),t):(r._remaining--,r._result[t]=e)},N.prototype._settledAt=function(e,t,r){var n=this,i=n.promise;i._state===re&&(n._remaining--,e===ie?S(i,r):n._result[t]=r),0===n._remaining&&x(i,n._result)},N.prototype._willSettleAt=function(e,t){var r=this;D(e,void 0,function(e){r._settledAt(ne,t,e)},function(e){r._settledAt(ie,t,e)})};var ce=k,le=B,ue=V,pe=j,de=0,fe=W;W.all=ce,W.race=le,W.resolve=ue,W.reject=pe,W._setScheduler=s,W._setAsap=c,W._asap=Q,W.prototype={constructor:W,then:function(e,t){var r=this,n=r._state;if(n===ne&&!e||n===ie&&!t)return this;var i=new this.constructor(m),o=r._result;if(n){var a=arguments[n-1];Q(function(){T(n,i,a,o)})}else D(r,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var he=U,ge={Promise:fe,polyfill:he};"function"==typeof define&&define.amd?define(function(){return ge}):"undefined"!=typeof t&&t.exports?t.exports=ge:"undefined"!=typeof this&&(this.ES6Promise=ge),he()}).call(this)}).call(this,{},"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1]);var Reflect;!function(e){function t(e,t,r,n){if(C(n)){if(C(r)){if(!E(e))throw new TypeError;if(!R(t))throw new TypeError;return p(e,t)}if(!E(e))throw new TypeError;if(!P(t))throw new TypeError;return r=S(r),f(e,t,r)}if(!E(e))throw new TypeError;if(!P(t))throw new TypeError;if(C(r))throw new TypeError;if(!P(n))throw new TypeError;return r=S(r),d(e,t,r,n)}function r(e,t){function r(r,n){if(C(n)){if(!R(r))throw new TypeError;_(e,t,r,void 0)}else{if(!P(r))throw new TypeError;n=S(n),_(e,t,r,n)}}return r}function n(e,t,r,n){if(!P(r))throw new TypeError;return C(n)||(n=S(n)),_(e,t,r,n)}function i(e,t,r){if(!P(t))throw new TypeError;return C(r)||(r=S(r)),g(e,t,r)}function o(e,t,r){if(!P(t))throw new TypeError;return C(r)||(r=S(r)),m(e,t,r)}function a(e,t,r){if(!P(t))throw new TypeError;return C(r)||(r=S(r)),v(e,t,r)}function s(e,t,r){if(!P(t))throw new TypeError;return C(r)||(r=S(r)),y(e,t,r)}function c(e,t){if(!P(e))throw new TypeError;return C(t)||(t=S(t)),b(e,t)}function l(e,t){if(!P(e))throw new TypeError;return C(t)||(t=S(t)),w(e,t)}function u(e,t,r){if(!P(t))throw new TypeError;C(r)||(r=S(r));var n=h(t,r,!1);if(C(n))return!1;if(!n["delete"](e))return!1;if(n.size>0)return!0;var i=B.get(t);return i["delete"](r),i.size>0?!0:(B["delete"](t),!0)}function p(e,t){for(var r=e.length-1;r>=0;--r){var n=e[r],i=n(t);if(!C(i)){if(!R(i))throw new TypeError;t=i}}return t}function d(e,t,r,n){for(var i=e.length-1;i>=0;--i){var o=e[i],a=o(t,r,n);if(!C(a)){if(!P(a))throw new TypeError;n=a}}return n}function f(e,t,r){for(var n=e.length-1;n>=0;--n){var i=e[n];i(t,r)}}function h(e,t,r){var n=B.get(e);if(!n){if(!r)return void 0;n=new M,B.set(e,n)}var i=n.get(t);if(!i){if(!r)return void 0;i=new M,n.set(t,i)}return i}function g(e,t,r){var n=m(e,t,r);if(n)return!0;var i=D(t);return null!==i?g(e,i,r):!1}function m(e,t,r){var n=h(t,r,!1);return void 0===n?!1:Boolean(n.has(e))}function v(e,t,r){var n=m(e,t,r);if(n)return y(e,t,r);var i=D(t);return null!==i?v(e,i,r):void 0}function y(e,t,r){var n=h(t,r,!1);return void 0===n?void 0:n.get(e)}function _(e,t,r,n){var i=h(r,n,!0);i.set(e,t)}function b(e,t){var r=w(e,t),n=D(e);if(null===n)return r;var i=b(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var o=new N,a=[],s=0;s=0?(this._cache=e,!0):!1},get:function(e){var t=this._find(e);return t>=0?(this._cache=e,this._values[t]):void 0},set:function(e,t){return this["delete"](e),this._keys.push(e),this._values.push(t),this._cache=e,this},"delete":function(e){var r=this._find(e);return r>=0?(this._keys.splice(r,1),this._values.splice(r,1),this._cache=t,!0):!1},clear:function(){this._keys.length=0,this._values.length=0,this._cache=t},forEach:function(e,t){for(var r=this.size,n=0;r>n;++n){var i=this._keys[n],o=this._values[n];this._cache=i,e.call(this,o,i,this)}},_find:function(e){for(var t=this._keys,r=t.length,n=0;r>n;++n)if(t[n]===e)return n;return-1}},e}function O(){function e(){this._map=new M}return e.prototype={get size(){return this._map.length},has:function(e){return this._map.has(e)},add:function(e){return this._map.set(e,e),this},"delete":function(e){return this._map["delete"](e)},clear:function(){this._map.clear()},forEach:function(e,t){this._map.forEach(e,t)}},e}function A(){function e(){this._key=i()}function t(e,t){for(var r=0;t>r;++r)e[r]=255*Math.random()|0}function r(e){if(c){var r=c.randomBytes(e);return r}if("function"==typeof Uint8Array){var r=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(r):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(r):t(r,e),r}var r=new Array(e);return t(r,e),r}function n(){var e=r(a);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",n=0;a>n;++n){var i=e[n];(4===n||6===n||8===n)&&(t+="-"),16>i&&(t+="0"),t+=i.toString(16).toLowerCase()}return t}function i(){var e;do e="@@WeakMap@@"+n();while(l.call(u,e));return u[e]=!0,e}function o(e,t){if(!l.call(e,p)){if(!t)return void 0;Object.defineProperty(e,p,{value:Object.create(null)})}return e[p]}var a=16,s="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),c=s&&require("crypto"),l=Object.prototype.hasOwnProperty,u={},p=i();return e.prototype={has:function(e){var t=o(e,!1);return t?this._key in t:!1},get:function(e){var t=o(e,!1);return t?t[this._key]:void 0},set:function(e,t){var r=o(e,!0);return r[this._key]=t,this},"delete":function(e){var t=o(e,!1);return t&&this._key in t?delete t[this._key]:!1},clear:function(){this._key=i()}},e}var T=Object.getPrototypeOf(Function),M="function"==typeof Map?Map:I(),N="function"==typeof Set?Set:O(),k="function"==typeof WeakMap?WeakMap:A(),B=new k;e.decorate=t,e.metadata=r,e.defineMetadata=n,e.hasMetadata=i,e.hasOwnMetadata=o,e.getMetadata=a,e.getOwnMetadata=s,e.getMetadataKeys=c,e.getOwnMetadataKeys=l,e.deleteMetadata=u,function(t){if("undefined"!=typeof t.Reflect){if(t.Reflect!==e)for(var r in e)t.Reflect[r]=e[r]}else t.Reflect=e}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof global?global:Function("return this;")())}(Reflect||(Reflect={})),System.register("angular2/src/core/facade/lang",[],!0,function(e,t,r){function n(e){return e.name}function i(){return N}function o(e){return e}function a(){return function(e){return e}}function s(){return function(e){return e}}function c(e){return void 0!==e&&null!==e}function l(e){return void 0===e||null===e}function u(e){return"string"==typeof e}function p(e){return"function"==typeof e}function d(e){return p(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return e instanceof M.Promise}function g(e){return Array.isArray(e)}function m(e){return"number"==typeof e}function v(e){return e instanceof t.Date&&!isNaN(e.valueOf())}function y(e){if("string"==typeof e)return e;if(void 0===e||null===e)return""+e;if(e.name)return e.name;var t=e.toString(),r=t.indexOf("\n");return-1===r?t:t.substring(0,r)}function _(e){return e}function b(e,t){return e}function w(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function C(e){return e}function E(e){return l(e)?null:e}function P(e){return l(e)?!1:e}function R(e){return null!==e&&("function"==typeof e||"object"==typeof e)}function x(e){console.log(e)}function S(e,t,r){for(var n=t.split("."),i=e;n.length>1;){var o=n.shift();i=i.hasOwnProperty(o)?i[o]:i[o]={}}(void 0===i||null===i)&&(i={}),i[n.shift()]=r}function D(){if(l(q))if(c(Symbol)&&c(Symbol.iterator))q=Symbol.iterator;else for(var e=Object.getOwnPropertyNames(Map.prototype),t=0;te?-1:e>t?1:0},e}();t.StringWrapper=k;var B=function(){function e(e){void 0===e&&(e=[]),this.parts=e}return e.prototype.add=function(e){this.parts.push(e)},e.prototype.toString=function(){return this.parts.join("")},e}();t.StringJoiner=B;var V=function(e){function t(t){e.call(this,t),this.message=t}return T(t,e),t.prototype.toString=function(){return this.message},t}(Error);t.NumberParseError=V;var j=function(){function e(){}return e.toFixed=function(e,t){return e.toFixed(t)},e.equal=function(e,t){return e===t},e.parseIntAutoRadix=function(e){var t=parseInt(e);if(isNaN(t))throw new V("Invalid integer literal when parsing "+e);return t},e.parseInt=function(e,t){if(10==t){if(/^(\-|\+)?[0-9]+$/.test(e))return parseInt(e,t)}else if(16==t){if(/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(e))return parseInt(e,t)}else{var r=parseInt(e,t);if(!isNaN(r))return r}throw new V("Invalid integer literal when parsing "+e+" in base "+t)},e.parseFloat=function(e){return parseFloat(e)},Object.defineProperty(e,"NaN",{get:function(){return 0/0},enumerable:!0,configurable:!0}),e.isNaN=function(e){return isNaN(e)},e.isInteger=function(e){return Number.isInteger(e)},e}();t.NumberWrapper=j,t.RegExp=M.RegExp;var L=function(){function e(){}return e.create=function(e,t){return void 0===t&&(t=""),t=t.replace(/g/g,""),new M.RegExp(e,t+"g")},e.firstMatch=function(e,t){return e.lastIndex=0,e.exec(t)},e.test=function(e,t){ +return e.lastIndex=0,e.test(t)},e.matcher=function(e,t){return e.lastIndex=0,{re:e,input:t}},e}();t.RegExpWrapper=L;var F=function(){function e(){}return e.next=function(e){return e.re.exec(e.input)},e}();t.RegExpMatcherWrapper=F;var W=function(){function e(){}return e.apply=function(e,t){return e.apply(null,t)},e}();t.FunctionWrapper=W,t.looseIdentical=w,t.getMapKey=C,t.normalizeBlank=E,t.normalizeBool=P,t.isJsObject=R,t.print=x;var U=function(){function e(){}return e.parse=function(e){return M.JSON.parse(e)},e.stringify=function(e){return M.JSON.stringify(e,null,2)},e}();t.Json=U;var H=function(){function e(){}return e.create=function(e,r,n,i,o,a,s){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),new t.Date(e,r-1,n,i,o,a,s)},e.fromMillis=function(e){return new t.Date(e)},e.toMillis=function(e){return e.getTime()},e.now=function(){return new t.Date},e.toJson=function(e){return e.toJSON()},e}();t.DateWrapper=H,t.setValueOnPath=S;var q=null;return t.getSymbolIterator=D,I.define=O,r.exports}),System.register("angular2/src/core/di/metadata",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this.token=e}return e.prototype.toString=function(){return"@Inject("+s.stringify(this.token)+")"},e=o([s.CONST(),a("design:paramtypes",[Object])],e)}();t.InjectMetadata=c;var l=function(){function e(){}return e.prototype.toString=function(){return"@Optional()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.OptionalMetadata=l;var u=function(){function e(){}return Object.defineProperty(e.prototype,"token",{get:function(){return null},enumerable:!0,configurable:!0}),e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.DependencyMetadata=u;var p=function(){function e(){}return e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.InjectableMetadata=p;var d=function(){function e(){}return e.prototype.toString=function(){return"@Self()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SelfMetadata=d;var f=function(){function e(){}return e.prototype.toString=function(){return"@SkipSelf()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SkipSelfMetadata=f;var h=function(){function e(){}return e.prototype.toString=function(){return"@Host()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();return t.HostMetadata=h,n.define=i,r.exports}),System.register("angular2/src/core/util/decorators",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return p.isFunction(e)&&e.hasOwnProperty("annotation")&&(e=e.annotation),e}function i(e,t){if(e===Object||e===String||e===Function||e===Number||e===Array)throw new Error("Can not use native "+p.stringify(e)+" as constructor");if(p.isFunction(e))return e;if(e instanceof Array){var r=e,i=e[e.length-1];if(!p.isFunction(i))throw new Error("Last position of Class method array must be Function in key "+t+" was '"+p.stringify(i)+"'");var o=r.length-1;if(o!=i.length)throw new Error("Number of annotations ("+o+") does not match number of arguments ("+i.length+") in the function: "+p.stringify(i));for(var a=[],s=0,c=r.length-1;c>s;s++){var l=[];a.push(l);var u=r[s];if(u instanceof Array)for(var f=0;f-1?(e.splice(r,1),!0):!1},e.clear=function(e){e.length=0},e.join=function(e,t){return e.join(t)},e.isEmpty=function(e){return 0==e.length},e.fill=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=null),e.fill(t,r,null===n?e.length:n)},e.equals=function(e,t){if(e.length!=t.length)return!1;for(var r=0;rn&&(r=o,n=a)}}return r},e}();t.ListWrapper=h,t.isListLikeIterable=n,t.iterateListLike=i;var g=function(){var e=new t.Set([1,2,3]);return 3===e.size?function(e){return new t.Set(e)}:function(e){var r=new t.Set(e);if(r.size!==e.length)for(var n=0;n1){var t=n(c.ListWrapper.reversed(e)),r=c.ListWrapper.map(t,function(e){return l.stringify(e.token)});return" ("+r.join(" -> ")+")"}return""}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=function(e){function t(t,r,n){e.call(this,"DI Exception"),this.keys=[r],this.injectors=[t],this.constructResolvingMessage=n,this.message=this.constructResolvingMessage(this.keys)}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t),this.message=this.constructResolvingMessage(this.keys)},Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(u.BaseException);t.AbstractBindingError=p;var d=function(e){function t(t,r){e.call(this,t,r,function(e){var t=l.stringify(c.ListWrapper.first(e).token);return"No provider for "+t+"!"+i(e)})}return s(t,e),t}(p);t.NoBindingError=d;var f=function(e){function t(t,r){e.call(this,t,r,function(e){return"Cannot instantiate cyclic dependency!"+i(e)})}return s(t,e),t}(p);t.CyclicDependencyError=f;var h=function(e){function t(t,r,n,i){e.call(this,"DI Exception",r,n,null),this.keys=[i],this.injectors=[t]}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t)},Object.defineProperty(t.prototype,"wrapperMessage",{get:function(){var e=l.stringify(c.ListWrapper.first(this.keys).token);return"Error during instantiation of "+e+"!"+i(this.keys)+"."},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"causeKey",{get:function(){return this.keys[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(u.WrappedException);t.InstantiationError=h;var g=function(e){function t(t){e.call(this,"Invalid binding - only instances of Binding and Type are allowed, got: "+t.toString())}return s(t,e),t}(u.BaseException);t.InvalidBindingError=g;var m=function(e){function t(r,n){e.call(this,t._genMessage(r,n))}return s(t,e),t._genMessage=function(e,t){for(var r=[],n=0,i=t.length;i>n;n++){var o=t[n];r.push(l.isBlank(o)||0==o.length?"?":c.ListWrapper.map(o,l.stringify).join(" "))}return"Cannot resolve all parameters for "+l.stringify(e)+"("+r.join(", ")+"). Make sure they all have valid type or annotations."},t}(u.BaseException);t.NoAnnotationError=m;var v=function(e){function t(t){e.call(this,"Index "+t+" is out-of-bounds.")}return s(t,e),t}(u.BaseException);t.OutOfBoundsError=v;var y=function(e){function t(t,r){e.call(this,"Cannot mix multi bindings and regular bindings, got: "+t.toString()+" "+r.toString())}return s(t,e),t}(u.BaseException);return t.MixingMultiBindingsWithRegularBindings=y,o.define=a,r.exports}),System.register("angular2/src/core/di/opaque_token",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this._desc=e}return e.prototype.toString=function(){return"Token "+this._desc},e=o([s.CONST(),a("design:paramtypes",[String])],e)}();return t.OpaqueToken=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/constants",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return a.isBlank(e)||e===s.Default}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang");!function(e){e[e.CheckOnce=0]="CheckOnce",e[e.Checked=1]="Checked",e[e.CheckAlways=2]="CheckAlways",e[e.Detached=3]="Detached",e[e.OnPush=4]="OnPush",e[e.Default=5]="Default",e[e.OnPushObserve=6]="OnPushObserve"}(t.ChangeDetectionStrategy||(t.ChangeDetectionStrategy={}));var s=t.ChangeDetectionStrategy;return t.CHANGE_DECTION_STRATEGY_VALUES=[s.CheckOnce,s.Checked,s.CheckAlways,s.Detached,s.OnPush,s.Default,s.OnPushObserve],t.isDefaultChangeDetectionStrategy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector",[],!0,function(e,t,r){function n(e){return e.constructor.prototype.onDestroy}var i=System.global,o=i.define;return i.define=void 0,t.implementsOnDestroy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/binding_record",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a="directiveLifecycle",s="native",c="directive",l="elementProperty",u="elementAttribute",p="elementClass",d="elementStyle",f="textNode",h="event",g="hostEvent",m=function(){function e(e,t,r,n,i){this.mode=e,this.elementIndex=t,this.name=r,this.unit=n,this.debug=i}return e.prototype.isDirective=function(){return this.mode===c},e.prototype.isElementProperty=function(){return this.mode===l},e.prototype.isElementAttribute=function(){return this.mode===u},e.prototype.isElementClass=function(){return this.mode===p},e.prototype.isElementStyle=function(){return this.mode===d},e.prototype.isTextNode=function(){return this.mode===f},e}();t.BindingTarget=m;var v=function(){function e(e,t,r,n,i,o,a){this.mode=e,this.target=t,this.implicitReceiver=r,this.ast=n,this.setter=i,this.lifecycleEvent=o,this.directiveRecord=a}return e.prototype.isDirectiveLifecycle=function(){return this.mode===a},e.prototype.callOnChanges=function(){return o.isPresent(this.directiveRecord)&&this.directiveRecord.callOnChanges},e.prototype.isDefaultChangeDetection=function(){return o.isBlank(this.directiveRecord)||this.directiveRecord.isDefaultChangeDetection()},e.createDirectiveDoCheck=function(t){return new e(a,null,0,null,null,"DoCheck",t)},e.createDirectiveOnInit=function(t){return new e(a,null,0,null,null,"OnInit",t)},e.createDirectiveOnChanges=function(t){return new e(a,null,0,null,null,"OnChanges",t)},e.createForDirective=function(t,r,n,i){var o=i.directiveIndex.elementIndex,a=new m(c,o,r,null,t.toString());return new e(c,a,0,t,n,null,i)},e.createForElementProperty=function(t,r,n){var i=new m(l,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementAttribute=function(t,r,n){var i=new m(u,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementClass=function(t,r,n){var i=new m(p,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementStyle=function(t,r,n,i){var o=new m(d,r,n,i,t.toString());return new e(s,o,0,t,null,null,null)},e.createForHostProperty=function(t,r,n){var i=new m(l,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostAttribute=function(t,r,n){var i=new m(u,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostClass=function(t,r,n){var i=new m(p,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostStyle=function(t,r,n,i){var o=new m(d,t.elementIndex,n,i,r.toString());return new e(s,o,t,r,null,null,null)},e.createForTextNode=function(t,r){var n=new m(f,r,null,null,t.toString());return new e(s,n,0,t,null,null,null)},e.createForEvent=function(t,r,n){var i=new m(h,n,r,null,t.toString());return new e(h,i,0,t,null,null,null)},e.createForHostEvent=function(t,r,n){var i=n.directiveIndex,o=new m(g,i.elementIndex,r,null,t.toString());return new e(g,o,i,t,null,null,n)},e}();return t.BindingRecord=v,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/directive_record",["angular2/src/core/facade/lang","angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/change_detection/constants"),s=function(){function e(e,t){this.elementIndex=e,this.directiveIndex=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.elementIndex+"_"+this.directiveIndex},enumerable:!0,configurable:!0}),e}();t.DirectiveIndex=s;var c=function(){function e(e){var t=void 0===e?{}:e,r=t.directiveIndex,n=t.callAfterContentInit,i=t.callAfterContentChecked,a=t.callAfterViewInit,s=t.callAfterViewChecked,c=t.callOnChanges,l=t.callDoCheck,u=t.callOnInit,p=t.changeDetection;this.directiveIndex=r,this.callAfterContentInit=o.normalizeBool(n),this.callAfterContentChecked=o.normalizeBool(i),this.callOnChanges=o.normalizeBool(c),this.callAfterViewInit=o.normalizeBool(a),this.callAfterViewChecked=o.normalizeBool(s),this.callDoCheck=o.normalizeBool(l),this.callOnInit=o.normalizeBool(u),this.changeDetection=p}return e.prototype.isDefaultChangeDetection=function(){return a.isDefaultChangeDetectionStrategy(this.changeDetection)},e}();return t.DirectiveRecord=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detector_ref",["angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/change_detection/constants"),a=function(){function e(e){this._cd=e}return e.prototype.markForCheck=function(){this._cd.markPathToRootAsCheckOnce(); + +},e.prototype.detach=function(){this._cd.mode=o.ChangeDetectionStrategy.Detached},e.prototype.detectChanges=function(){this._cd.detectChanges()},e.prototype.reattach=function(){this._cd.mode=o.ChangeDetectionStrategy.CheckAlways,this.markForCheck()},e}();return t.ChangeDetectorRef=a,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/exceptions",["angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/exceptions"),s=function(e){function t(t,r,n,i){e.call(this,"Expression '"+t+"' has changed after it was checked. "+("Previous value: '"+r+"'. Current value: '"+n+"'"))}return o(t,e),t}(a.BaseException);t.ExpressionChangedAfterItHasBeenCheckedException=s;var c=function(e){function t(t,r,n,i){e.call(this,r+" in ["+t+"]",r,n,i),this.location=t}return o(t,e),t}(a.WrappedException);t.ChangeDetectionError=c;var l=function(e){function t(){e.call(this,"Attempt to detect changes on a dehydrated detector.")}return o(t,e),t}(a.BaseException);return t.DehydratedException=l,n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_impl",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){var e=d.global.wtf;return e&&(u=e.trace)?(p=u.events,!0):!1}function i(e,t){return void 0===t&&(t=null),p.createScope(e,t)}function o(e,t){return u.leaveScope(e,t),t}function a(e,t){return u.beginTimeRange(e,t)}function s(e){u.endTimeRange(e)}var c=System.global,l=c.define;c.define=void 0;var u,p,d=e("angular2/src/core/facade/lang");return t.detectWTF=n,t.createScope=i,t.leave=o,t.startTimeRange=a,t.endTimeRange=s,c.define=l,r.exports}),System.register("angular2/src/core/change_detection/observable_facade",[],!0,function(e,t,r){function n(e){return!1}var i=System.global,o=i.define;return i.define=void 0,t.isObservable=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_name_util",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e){return a.StringWrapper.replaceAll(e,y,"")}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c="alreadyChecked",l="context",u="propertyBindingIndex",p="directiveIndices",d="dispatcher",f="locals",h="mode",g="pipes",m="protos";t.CONTEXT_INDEX=0;var v="this.",y=a.RegExpWrapper.create("\\W","g");t.sanitizeName=n;var _=function(){function e(e,r,i,o){this._records=e,this._eventBindings=r,this._directiveRecords=i,this._utilName=o,this._sanitizedNames=s.ListWrapper.createFixedSize(this._records.length+1),this._sanitizedNames[t.CONTEXT_INDEX]=l;for(var a=0,c=this._records.length;c>a;++a)this._sanitizedNames[a+1]=n(""+this._records[a].name+a);this._sanitizedEventNames=new s.Map;for(var u=0;ua;++a)d.push(n(""+p.records[a].name+a+"_"+u));this._sanitizedEventNames.set(p,d)}}return e.prototype._addFieldPrefix=function(e){return""+v+e},e.prototype.getDispatcherName=function(){return this._addFieldPrefix(d)},e.prototype.getPipesAccessorName=function(){return this._addFieldPrefix(g)},e.prototype.getProtosName=function(){return this._addFieldPrefix(m)},e.prototype.getDirectivesAccessorName=function(){return this._addFieldPrefix(p)},e.prototype.getLocalsAccessorName=function(){return this._addFieldPrefix(f)},e.prototype.getAlreadyCheckedName=function(){return this._addFieldPrefix(c)},e.prototype.getModeName=function(){return this._addFieldPrefix(h)},e.prototype.getPropertyBindingIndex=function(){return this._addFieldPrefix(u)},e.prototype.getLocalName=function(e){return"l_"+this._sanitizedNames[e]},e.prototype.getEventLocalName=function(e,t){return"l_"+s.MapWrapper.get(this._sanitizedEventNames,e)[t]},e.prototype.getChangeName=function(e){return"c_"+this._sanitizedNames[e]},e.prototype.genInitLocals=function(){for(var e=[],r=[],n=0,i=this.getFieldCount();i>n;++n)if(n==t.CONTEXT_INDEX)e.push(this.getLocalName(n)+" = "+this.getFieldName(n));else{var o=this._records[n-1];if(o.argumentToPureFunction){var a=this.getChangeName(n);e.push(this.getLocalName(n)+","+a),r.push(a)}else e.push(""+this.getLocalName(n))}var c=s.ListWrapper.isEmpty(r)?"":s.ListWrapper.join(r,"=")+" = false;";return"var "+s.ListWrapper.join(e,",")+";"+c},e.prototype.genInitEventLocals=function(){var e=this,r=[this.getLocalName(t.CONTEXT_INDEX)+" = "+this.getFieldName(t.CONTEXT_INDEX)];return s.MapWrapper.forEach(this._sanitizedEventNames,function(n,i){for(var o=0;o1?"var "+r.join(",")+";":""},e.prototype.getPreventDefaultAccesor=function(){return"preventDefault"},e.prototype.getFieldCount=function(){return this._sanitizedNames.length},e.prototype.getFieldName=function(e){return this._addFieldPrefix(this._sanitizedNames[e])},e.prototype.getAllFieldNames=function(){for(var e=[],t=0,r=this.getFieldCount();r>t;++t)(0===t||this._records[t-1].shouldBeChecked())&&e.push(this.getFieldName(t));for(var n=0,i=this._records.length;i>n;++n){var o=this._records[n];o.isPipeRecord()&&e.push(this.getPipeName(o.selfIndex))}for(var a=0,s=this._directiveRecords.length;s>a;++a){var c=this._directiveRecords[a];e.push(this.getDirectiveName(c.directiveIndex)),c.isDefaultChangeDetection()||e.push(this.getDetectorName(c.directiveIndex))}return e},e.prototype.genDehydrateFields=function(){var e=this.getAllFieldNames();return s.ListWrapper.removeAt(e,t.CONTEXT_INDEX),s.ListWrapper.isEmpty(e)?"":(e.push(this._utilName+".uninitialized;"),s.ListWrapper.join(e," = "))},e.prototype.genPipeOnDestroy=function(){var e=this;return s.ListWrapper.join(s.ListWrapper.map(s.ListWrapper.filter(this._records,function(e){return e.isPipeRecord()}),function(t){return e._utilName+".callPipeOnDestroy("+e.getPipeName(t.selfIndex)+");"}),"\n")},e.prototype.getPipeName=function(e){return this._addFieldPrefix(this._sanitizedNames[e]+"_pipe")},e.prototype.getDirectiveName=function(e){return this._addFieldPrefix("directive_"+e.name)},e.prototype.getDetectorName=function(e){return this._addFieldPrefix("detector_"+e.name)},e}();return t.CodegenNameUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_facade",[],!0,function(e,t,r){function n(e){return JSON.stringify(e)}function i(e){return"'"+e+"'"}function o(e){return e.join(" + ")}var a=System.global,s=a.define;return a.define=void 0,t.codify=n,t.rawString=i,t.combineGeneratedStrings=o,a.define=s,r.exports}),System.register("angular2/src/core/change_detection/proto_record",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.Self=0]="Self",e[e.Const=1]="Const",e[e.PrimitiveOp=2]="PrimitiveOp",e[e.PropertyRead=3]="PropertyRead",e[e.PropertyWrite=4]="PropertyWrite",e[e.Local=5]="Local",e[e.InvokeMethod=6]="InvokeMethod",e[e.InvokeClosure=7]="InvokeClosure",e[e.KeyedRead=8]="KeyedRead",e[e.KeyedWrite=9]="KeyedWrite",e[e.Pipe=10]="Pipe",e[e.Interpolate=11]="Interpolate",e[e.SafeProperty=12]="SafeProperty",e[e.CollectionLiteral=13]="CollectionLiteral",e[e.SafeMethodInvoke=14]="SafeMethodInvoke",e[e.DirectiveLifecycle=15]="DirectiveLifecycle",e[e.Chain=16]="Chain"}(t.RecordType||(t.RecordType={}));var o=t.RecordType,a=function(){function e(e,t,r,n,i,o,a,s,c,l,u,p,d,f){this.mode=e,this.name=t,this.funcOrValue=r,this.args=n,this.fixedArgs=i,this.contextIndex=o,this.directiveIndex=a,this.selfIndex=s,this.bindingRecord=c,this.lastInBinding=l,this.lastInDirective=u,this.argumentToPureFunction=p,this.referencedBySelf=d,this.propertyBindingIndex=f}return e.prototype.isPureFunction=function(){return this.mode===o.Interpolate||this.mode===o.CollectionLiteral},e.prototype.isUsedByOtherRecord=function(){return!this.lastInBinding||this.referencedBySelf},e.prototype.shouldBeChecked=function(){return this.argumentToPureFunction||this.lastInBinding||this.isPureFunction()||this.isPipeRecord()},e.prototype.isPipeRecord=function(){return this.mode===o.Pipe},e.prototype.isLifeCycleRecord=function(){return this.mode===o.DirectiveLifecycle},e}();return t.ProtoRecord=a,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/ast",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=function(){function e(){}return e.prototype.visit=function(e){return null},e.prototype.toString=function(){return"AST"},e}();t.AST=c;var l=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){},t}(c);t.EmptyExpr=l;var u=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){return e.visitImplicitReceiver(this)},t}(c);t.ImplicitReceiver=u;var p=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitChain(this)},t}(c);t.Chain=p;var d=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitConditional(this)},t}(c);t.Conditional=d;var f=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitIf(this)},t}(c);t.If=f;var h=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyRead(this)},t}(c);t.PropertyRead=h;var g=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.setter=n,this.value=i}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyWrite(this)},t}(c);t.PropertyWrite=g;var m=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitSafePropertyRead(this)},t}(c);t.SafePropertyRead=m;var v=function(e){function t(t,r){e.call(this),this.obj=t,this.key=r}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedRead(this)},t}(c);t.KeyedRead=v;var y=function(e){function t(t,r,n){e.call(this),this.obj=t,this.key=r,this.value=n}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedWrite(this)},t}(c);t.KeyedWrite=y;var _=function(e){function t(t,r,n){e.call(this),this.exp=t,this.name=r,this.args=n}return o(t,e),t.prototype.visit=function(e){return e.visitPipe(this)},t}(c);t.BindingPipe=_;var b=function(e){function t(t){e.call(this),this.value=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralPrimitive(this)},t}(c);t.LiteralPrimitive=b;var w=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralArray(this)},t}(c);t.LiteralArray=w;var C=function(e){function t(t,r){e.call(this),this.keys=t,this.values=r}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralMap(this)},t}(c);t.LiteralMap=C;var E=function(e){function t(t,r){e.call(this),this.strings=t,this.expressions=r}return o(t,e),t.prototype.visit=function(e){e.visitInterpolation(this)},t}(c);t.Interpolation=E;var P=function(e){function t(t,r,n){e.call(this),this.operation=t,this.left=r,this.right=n}return o(t,e),t.prototype.visit=function(e){return e.visitBinary(this)},t}(c);t.Binary=P;var R=function(e){function t(t){e.call(this),this.expression=t}return o(t,e),t.prototype.visit=function(e){return e.visitPrefixNot(this)},t}(c);t.PrefixNot=R;var x=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitMethodCall(this)},t}(c);t.MethodCall=x;var S=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitSafeMethodCall(this)},t}(c);t.SafeMethodCall=S;var D=function(e){function t(t,r){e.call(this),this.target=t,this.args=r}return o(t,e),t.prototype.visit=function(e){return e.visitFunctionCall(this)},t}(c);t.FunctionCall=D;var I=function(e){function t(t,r,n){e.call(this),this.ast=t,this.source=r,this.location=n}return o(t,e),t.prototype.visit=function(e){return this.ast.visit(e)},t.prototype.toString=function(){return this.source+" in "+this.location},t}(c);t.ASTWithSource=I;var O=function(){function e(e,t,r,n){this.key=e,this.keyIsVar=t,this.name=r,this.expression=n}return e}();t.TemplateBinding=O;var A=function(){function e(){}return e.prototype.visitBinary=function(e){return e.left.visit(this),e.right.visit(this),null},e.prototype.visitChain=function(e){return this.visitAll(e.expressions)},e.prototype.visitConditional=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitIf=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitPipe=function(e){return e.exp.visit(this),this.visitAll(e.args),null},e.prototype.visitFunctionCall=function(e){return e.target.visit(this),this.visitAll(e.args),null},e.prototype.visitImplicitReceiver=function(e){return null},e.prototype.visitInterpolation=function(e){return this.visitAll(e.expressions)},e.prototype.visitKeyedRead=function(e){return e.obj.visit(this),e.key.visit(this),null},e.prototype.visitKeyedWrite=function(e){return e.obj.visit(this),e.key.visit(this),e.value.visit(this),null},e.prototype.visitLiteralArray=function(e){return this.visitAll(e.expressions)},e.prototype.visitLiteralMap=function(e){return this.visitAll(e.values)},e.prototype.visitLiteralPrimitive=function(e){return null},e.prototype.visitMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitPrefixNot=function(e){return e.expression.visit(this),null},e.prototype.visitPropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitPropertyWrite=function(e){return e.receiver.visit(this),e.value.visit(this),null},e.prototype.visitSafePropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitSafeMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitAll=function(e){var t=this;return s.ListWrapper.forEach(e,function(e){e.visit(t)}),null},e}();t.RecursiveAstVisitor=A;var T=function(){function e(){}return e.prototype.visitImplicitReceiver=function(e){return e},e.prototype.visitInterpolation=function(e){return new E(e.strings,this.visitAll(e.expressions))},e.prototype.visitLiteralPrimitive=function(e){return new b(e.value)},e.prototype.visitPropertyRead=function(e){return new h(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitPropertyWrite=function(e){return new g(e.receiver.visit(this),e.name,e.setter,e.value)},e.prototype.visitSafePropertyRead=function(e){return new m(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitMethodCall=function(e){return new x(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitSafeMethodCall=function(e){return new S(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitFunctionCall=function(e){return new D(e.target.visit(this),this.visitAll(e.args))},e.prototype.visitLiteralArray=function(e){return new w(this.visitAll(e.expressions))},e.prototype.visitLiteralMap=function(e){return new C(e.keys,this.visitAll(e.values))},e.prototype.visitBinary=function(e){return new P(e.operation,e.left.visit(this),e.right.visit(this))},e.prototype.visitPrefixNot=function(e){return new R(e.expression.visit(this))},e.prototype.visitConditional=function(e){return new d(e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))},e.prototype.visitPipe=function(e){return new _(e.exp.visit(this),e.name,this.visitAll(e.args))},e.prototype.visitKeyedRead=function(e){return new v(e.obj.visit(this),e.key.visit(this))},e.prototype.visitKeyedWrite=function(e){return new y(e.obj.visit(this),e.key.visit(this),e.value.visit(this))},e.prototype.visitAll=function(e){for(var t=s.ListWrapper.createFixedSize(e.length),r=0;r=0;--t){var r=e[t];r.callAfterContentInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterContentInit(),r.callAfterContentChecked&&this._getDirectiveFor(r.directiveIndex).afterContentChecked()}},t.prototype.afterViewLifecycleCallbacksInternal=function(){for(var e=this._directiveRecords,t=e.length-1;t>=0;--t){var r=e[t];r.callAfterViewInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterViewInit(),r.callAfterViewChecked&&this._getDirectiveFor(r.directiveIndex).afterViewChecked()}},t.prototype._updateDirectiveOrElement=function(t,r){if(s.isBlank(r.directiveRecord))e.prototype.notifyDispatcher.call(this,t.currentValue);else{var n=r.directiveRecord.directiveIndex;r.setter(this._getDirectiveFor(n),t.currentValue)}this._genConfig.logBindingUpdate&&e.prototype.logBindingUpdate.call(this,t.currentValue)},t.prototype._addChange=function(t,r,n){return t.callOnChanges()?e.prototype.addChange.call(this,n,r.previousValue,r.currentValue):n},t.prototype._getDirectiveFor=function(e){return this.directives.getDirectiveFor(e)},t.prototype._getDetectorFor=function(e){return this.directives.getDetectorFor(e)},t.prototype._check=function(e,t,r,n){return e.isPipeRecord()?this._pipeCheck(e,t,r):this._referenceCheck(e,t,r,n)},t.prototype._referenceCheck=function(t,r,i,o){if(this._pureFuncAndArgsDidNotChange(t))return this._setChanged(t,!1),null;var a=this._calculateCurrValue(t,i,o);if(this.strategy===d.ChangeDetectionStrategy.OnPushObserve&&e.prototype.observeValue.call(this,a,t.selfIndex),t.shouldBeChecked()){var s=this._readSelf(t,i);if(n(s,a))return this._setChanged(t,!1),null;if(t.lastInBinding){var c=p.ChangeDetectionUtil.simpleChange(s,a);return r&&this.throwOnChangeError(s,a),this._writeSelf(t,a,i),this._setChanged(t,!0),c}return this._writeSelf(t,a,i),this._setChanged(t,!0),null}return this._writeSelf(t,a,i),this._setChanged(t,!0),null},t.prototype._calculateCurrValue=function(e,t,r){switch(e.mode){case f.RecordType.Self:return this._readContext(e,t);case f.RecordType.Const:return e.funcOrValue;case f.RecordType.PropertyRead:var n=this._readContext(e,t);return e.funcOrValue(n);case f.RecordType.SafeProperty:var n=this._readContext(e,t);return s.isBlank(n)?null:e.funcOrValue(n);case f.RecordType.PropertyWrite:var n=this._readContext(e,t),i=this._readArgs(e,t)[0];return e.funcOrValue(n,i),i;case f.RecordType.KeyedWrite:var n=this._readContext(e,t),o=this._readArgs(e,t)[0],i=this._readArgs(e,t)[1];return n[o]=i,i;case f.RecordType.Local:return r.get(e.name);case f.RecordType.InvokeMethod:var n=this._readContext(e,t),a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.SafeMethodInvoke:var n=this._readContext(e,t);if(s.isBlank(n))return null;var a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.KeyedRead:var l=this._readArgs(e,t)[0];return this._readContext(e,t)[l];case f.RecordType.Chain:var a=this._readArgs(e,t);return a[a.length-1];case f.RecordType.InvokeClosure:return s.FunctionWrapper.apply(this._readContext(e,t),this._readArgs(e,t));case f.RecordType.Interpolate:case f.RecordType.PrimitiveOp:case f.RecordType.CollectionLiteral:return s.FunctionWrapper.apply(e.funcOrValue,this._readArgs(e,t));default:throw new c.BaseException("Unknown operation "+e.mode)}},t.prototype._pipeCheck=function(e,t,r){var i=this._readContext(e,r),o=this._pipeFor(e,i);if(!o.pure||this._argsOrContextChanged(e)){var a=this._readArgs(e,r),s=o.pipe.transform(i,a);if(e.shouldBeChecked()){var c=this._readSelf(e,r);if(n(c,s))return this._setChanged(e,!1),null;if(s=p.ChangeDetectionUtil.unwrapValue(s),e.lastInBinding){var l=p.ChangeDetectionUtil.simpleChange(c,s);return t&&this.throwOnChangeError(c,s),this._writeSelf(e,s,r),this._setChanged(e,!0),l}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}},t.prototype._pipeFor=function(e,t){var r=this._readPipe(e);if(s.isPresent(r))return r;var n=this.pipes.get(e.name);return this._writePipe(e,n),n},t.prototype._readContext=function(e,t){return-1==e.contextIndex?this._getDirectiveFor(e.directiveIndex):t[e.contextIndex]},t.prototype._readSelf=function(e,t){return t[e.selfIndex]},t.prototype._writeSelf=function(e,t,r){r[e.selfIndex]=t},t.prototype._readPipe=function(e){return this.localPipes[e.selfIndex]},t.prototype._writePipe=function(e,t){this.localPipes[e.selfIndex]=t},t.prototype._setChanged=function(e,t){e.argumentToPureFunction&&(this.changes[e.selfIndex]=t)},t.prototype._pureFuncAndArgsDidNotChange=function(e){return e.isPureFunction()&&!this._argsChanged(e)},t.prototype._argsChanged=function(e){for(var t=e.args,r=0;r"+u.stringify(this.currentIndex)+"]"},e}();t.CollectionChangeRecord=f;var h=function(){function e(){this._head=null,this._tail=null}return e.prototype.add=function(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)},e.prototype.get=function(e,t){var r;for(r=this._head;null!==r;r=r._nextDup)if((null===t||t"+c.stringify(this.currentValue)+"]"},e}();return t.KVChangeRecord=d,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/interfaces",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(){}return e.prototype.getProtoChangeDetector=function(e,t){return null},Object.defineProperty(e.prototype,"generateDetectors",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"genConfig",{get:function(){return null},enumerable:!0,configurable:!0}),e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.ChangeDetection=c;var l=function(){function e(e,t,r,n,i,o){this.element=e,this.componentElement=t,this.directive=r,this.context=n,this.locals=i,this.injector=o}return e}();t.DebugContext=l;var u=function(){function e(e,t,r,n){this.genCheckNoChanges=e,this.genDebugInfo=t,this.logBindingUpdate=r,this.useJit=n}return e}();t.ChangeDetectorGenConfig=u;var p=function(){function e(e,t,r,n,i,o,a){this.id=e,this.strategy=t,this.variableNames=r,this.bindingRecords=n,this.eventRecords=i,this.directiveRecords=o,this.genConfig=a}return e}();return t.ChangeDetectorDefinition=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/lexer",["angular2/src/core/di/decorators","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){function n(e,t){return new S(e,R.Character,t,E.StringWrapper.fromCharCode(t))}function i(e,t){return new S(e,R.Identifier,0,t)}function o(e,t){return new S(e,R.Keyword,0,t)}function a(e,t){return new S(e,R.Operator,0,t)}function s(e,t){return new S(e,R.String,0,t)}function c(e,t){return new S(e,R.Number,t,"")}function l(e){return e>=t.$TAB&&e<=t.$SPACE||e==q}function u(e){return e>=k&&H>=e||e>=O&&T>=e||e==N||e==t.$$}function p(e){return e>=k&&H>=e||e>=O&&T>=e||e>=D&&I>=e||e==N||e==t.$$}function d(e){return e>=D&&I>=e}function f(e){return e==B||e==A}function h(e){return e==t.$MINUS||e==t.$PLUS}function g(e){switch(e){case j:return t.$LF;case V:return t.$FF;case L:return t.$CR;case F:return t.$TAB;case U:return t.$VTAB;default:return e}}var m=System.global,v=m.define;m.define=void 0;var y=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},_=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},b=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},w=e("angular2/src/core/di/decorators"),C=e("angular2/src/core/facade/collection"),E=e("angular2/src/core/facade/lang"),P=e("angular2/src/core/facade/exceptions");!function(e){e[e.Character=0]="Character",e[e.Identifier=1]="Identifier",e[e.Keyword=2]="Keyword",e[e.String=3]="String",e[e.Operator=4]="Operator",e[e.Number=5]="Number"}(t.TokenType||(t.TokenType={}));var R=t.TokenType,x=function(){function e(){}return e.prototype.tokenize=function(e){for(var t=new K(e),r=[],n=t.scanToken();null!=n;)r.push(n),n=t.scanToken();return r},e=_([w.Injectable(),b("design:paramtypes",[])],e)}();t.Lexer=x;var S=function(){function e(e,t,r,n){this.index=e,this.type=t,this.numValue=r,this.strValue=n}return e.prototype.isCharacter=function(e){return this.type==R.Character&&this.numValue==e},e.prototype.isNumber=function(){return this.type==R.Number},e.prototype.isString=function(){return this.type==R.String},e.prototype.isOperator=function(e){return this.type==R.Operator&&this.strValue==e},e.prototype.isIdentifier=function(){return this.type==R.Identifier},e.prototype.isKeyword=function(){return this.type==R.Keyword},e.prototype.isKeywordVar=function(){return this.type==R.Keyword&&"var"==this.strValue},e.prototype.isKeywordNull=function(){return this.type==R.Keyword&&"null"==this.strValue},e.prototype.isKeywordUndefined=function(){return this.type==R.Keyword&&"undefined"==this.strValue},e.prototype.isKeywordTrue=function(){return this.type==R.Keyword&&"true"==this.strValue},e.prototype.isKeywordIf=function(){return this.type==R.Keyword&&"if"==this.strValue},e.prototype.isKeywordElse=function(){return this.type==R.Keyword&&"else"==this.strValue},e.prototype.isKeywordFalse=function(){return this.type==R.Keyword&&"false"==this.strValue},e.prototype.toNumber=function(){return this.type==R.Number?this.numValue:-1},e.prototype.toString=function(){switch(this.type){case R.Character:case R.Identifier:case R.Keyword:case R.Operator:case R.String:return this.strValue;case R.Number:return this.numValue.toString();default:return null}},e}();t.Token=S,t.EOF=new S(-1,R.Character,0,""),t.$EOF=0,t.$TAB=9,t.$LF=10,t.$VTAB=11,t.$FF=12,t.$CR=13,t.$SPACE=32,t.$BANG=33,t.$DQ=34,t.$HASH=35,t.$$=36,t.$PERCENT=37,t.$AMPERSAND=38,t.$SQ=39,t.$LPAREN=40,t.$RPAREN=41,t.$STAR=42,t.$PLUS=43,t.$COMMA=44,t.$MINUS=45,t.$PERIOD=46,t.$SLASH=47,t.$COLON=58,t.$SEMICOLON=59,t.$LT=60,t.$EQ=61,t.$GT=62,t.$QUESTION=63;var D=48,I=57,O=65,A=69,T=90;t.$LBRACKET=91,t.$BACKSLASH=92,t.$RBRACKET=93;var M=94,N=95,k=97,B=101,V=102,j=110,L=114,F=116,W=117,U=118,H=122;t.$LBRACE=123,t.$BAR=124,t.$RBRACE=125;var q=160,z=function(e){function t(t){e.call(this),this.message=t}return y(t,e),t.prototype.toString=function(){return this.message},t}(P.BaseException);t.ScannerError=z;var K=function(){function e(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}return e.prototype.advance=function(){this.peek=++this.index>=this.length?t.$EOF:E.StringWrapper.charCodeAt(this.input,this.index)},e.prototype.scanToken=function(){for(var e=this.input,r=this.length,i=this.peek,o=this.index;i<=t.$SPACE;){if(++o>=r){i=t.$EOF;break}i=E.StringWrapper.charCodeAt(e,o)}if(this.peek=i,this.index=o,o>=r)return null;if(u(i))return this.scanIdentifier();if(d(i))return this.scanNumber(o);var a=o;switch(i){case t.$PERIOD:return this.advance(),d(this.peek)?this.scanNumber(a):n(a,t.$PERIOD);case t.$LPAREN:case t.$RPAREN:case t.$LBRACE:case t.$RBRACE:case t.$LBRACKET:case t.$RBRACKET:case t.$COMMA:case t.$COLON:case t.$SEMICOLON:return this.scanCharacter(a,i);case t.$SQ:case t.$DQ:return this.scanString();case t.$HASH:case t.$PLUS:case t.$MINUS:case t.$STAR:case t.$SLASH:case t.$PERCENT:case M:return this.scanOperator(a,E.StringWrapper.fromCharCode(i));case t.$QUESTION:return this.scanComplexOperator(a,"?",t.$PERIOD,".");case t.$LT:case t.$GT:return this.scanComplexOperator(a,E.StringWrapper.fromCharCode(i),t.$EQ,"=");case t.$BANG:case t.$EQ:return this.scanComplexOperator(a,E.StringWrapper.fromCharCode(i),t.$EQ,"=",t.$EQ,"=");case t.$AMPERSAND:return this.scanComplexOperator(a,"&",t.$AMPERSAND,"&");case t.$BAR:return this.scanComplexOperator(a,"|",t.$BAR,"|");case q:for(;l(this.peek);)this.advance();return this.scanToken()}return this.error("Unexpected character ["+E.StringWrapper.fromCharCode(i)+"]",0),null},e.prototype.scanCharacter=function(e,t){return assert(this.peek==t),this.advance(),n(e,t)},e.prototype.scanOperator=function(e,t){return assert(this.peek==E.StringWrapper.charCodeAt(t,0)),assert(C.SetWrapper.has(G,t)),this.advance(),a(e,t)},e.prototype.scanComplexOperator=function(e,t,r,n,i,o){assert(this.peek==E.StringWrapper.charCodeAt(t,0)),this.advance();var s=t;return this.peek==r&&(this.advance(),s+=n),E.isPresent(i)&&this.peek==i&&(this.advance(),s+=o),assert(C.SetWrapper.has(G,s)),a(e,s)},e.prototype.scanIdentifier=function(){assert(u(this.peek));var e=this.index;for(this.advance();p(this.peek);)this.advance();var t=this.input.substring(e,this.index);return C.SetWrapper.has($,t)?o(e,t):i(e,t)},e.prototype.scanNumber=function(e){assert(d(this.peek));var r=this.index===e;for(this.advance();;){if(d(this.peek));else if(this.peek==t.$PERIOD)r=!1;else{if(!f(this.peek))break;this.advance(),h(this.peek)&&this.advance(),d(this.peek)||this.error("Invalid exponent",-1),r=!1}this.advance()}var n=this.input.substring(e,this.index),i=r?E.NumberWrapper.parseIntAutoRadix(n):E.NumberWrapper.parseFloat(n);return c(e,i)},e.prototype.scanString=function(){assert(this.peek==t.$SQ||this.peek==t.$DQ);var e=this.index,r=this.peek;this.advance();for(var n,i=this.index,o=this.input;this.peek!=r;)if(this.peek==t.$BACKSLASH){null==n&&(n=new E.StringJoiner),n.add(o.substring(i,this.index)),this.advance();var a;if(this.peek==W){var c=o.substring(this.index+1,this.index+5);try{a=E.NumberWrapper.parseInt(c,16)}catch(l){this.error("Invalid unicode escape [\\u"+c+"]",0)}for(var u=0;5>u;u++)this.advance()}else a=g(this.peek),this.advance();n.add(E.StringWrapper.fromCharCode(a)),i=this.index}else this.peek==t.$EOF?this.error("Unterminated quote",0):this.advance();var p=o.substring(i,this.index);this.advance();var d=p;return null!=n&&(n.add(p),d=n.toString()),s(e,d)},e.prototype.error=function(e,t){var r=this.index+t;throw new z("Lexer Error: "+e+" at column "+r+" in expression ["+this.input+"]")},e}(),G=C.SetWrapper.createFromList(["+","-","*","/","%","^","=","==","!=","===","!==","<",">","<=",">=","&&","||","&","|","!","?","#","?."]),$=C.SetWrapper.createFromList(["var","null","undefined","true","false","if","else"]);return m.define=v,r.exports}),System.register("angular2/src/core/change_detection/parser/parser",["angular2/src/core/di/decorators","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/lexer","angular2/src/core/reflection/reflection","angular2/src/core/change_detection/parser/ast"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di/decorators"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/change_detection/parser/lexer"),f=e("angular2/src/core/reflection/reflection"),h=e("angular2/src/core/change_detection/parser/ast"),g=new h.ImplicitReceiver,m=/\{\{(.*?)\}\}/g,v=function(e){function t(t,r,n,i){e.call(this,"Parser Error: "+t+" "+n+" ["+r+"] in "+i)}return o(t,e),t}(u.BaseException),y=function(){function e(e,t){void 0===t&&(t=null),this._lexer=e,this._reflector=l.isPresent(t)?t:f.reflector}return e.prototype.parseAction=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!0).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseSimpleBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseSimpleBinding();return new h.ASTWithSource(n,e,t)},e.prototype.parseTemplateBindings=function(e,t){var r=this._lexer.tokenize(e);return new _(e,t,r,this._reflector,!1).parseTemplateBindings()},e.prototype.parseInterpolation=function(e,t){var r=l.StringWrapper.split(e,m);if(r.length<=1)return null;for(var n=[],i=[],o=0;o0))throw new v("Blank expressions are not allowed in interpolated strings",e,"at column "+this._findInterpolationErrorColumn(r,o)+" in",t);var s=this._lexer.tokenize(a),c=new _(e,t,s,this._reflector,!1).parseChain();i.push(c)}}return new h.ASTWithSource(new h.Interpolation(n,i),e,t)},e.prototype.wrapLiteralPrimitive=function(e,t){return new h.ASTWithSource(new h.LiteralPrimitive(e),e,t)},e.prototype._checkNoInterpolation=function(e,t){var r=l.StringWrapper.split(e,m);if(r.length>1)throw new v("Got interpolation ({{}}) where expression was expected",e,"at column "+this._findInterpolationErrorColumn(r,1)+" in",t)},e.prototype._findInterpolationErrorColumn=function(e,t){for(var r="",n=0;t>n;n++)r+=n%2===0?e[n]:"{{"+e[n]+"}}";return r.length},e=a([c.Injectable(),s("design:paramtypes",[d.Lexer,f.Reflector])],e)}();t.Parser=y;var _=function(){function e(e,t,r,n,i){this.input=e,this.location=t,this.tokens=r,this.reflector=n,this.parseAction=i,this.index=0}return e.prototype.peek=function(e){var t=this.index+e;return t"))e=new h.Binary(">",e,this.parseAdditive());else if(this.optionalOperator("<="))e=new h.Binary("<=",e,this.parseAdditive());else{if(!this.optionalOperator(">="))return e;e=new h.Binary(">=",e,this.parseAdditive())}}, +e.prototype.parseAdditive=function(){for(var e=this.parseMultiplicative();;)if(this.optionalOperator("+"))e=new h.Binary("+",e,this.parseMultiplicative());else{if(!this.optionalOperator("-"))return e;e=new h.Binary("-",e,this.parseMultiplicative())}},e.prototype.parseMultiplicative=function(){for(var e=this.parsePrefix();;)if(this.optionalOperator("*"))e=new h.Binary("*",e,this.parsePrefix());else if(this.optionalOperator("%"))e=new h.Binary("%",e,this.parsePrefix());else{if(!this.optionalOperator("/"))return e;e=new h.Binary("/",e,this.parsePrefix())}},e.prototype.parsePrefix=function(){return this.optionalOperator("+")?this.parsePrefix():this.optionalOperator("-")?new h.Binary("-",new h.LiteralPrimitive(0),this.parsePrefix()):this.optionalOperator("!")?new h.PrefixNot(this.parsePrefix()):this.parseCallChain()},e.prototype.parseCallChain=function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(d.$PERIOD))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(d.$LBRACKET)){var t=this.parsePipe();if(this.expectCharacter(d.$RBRACKET),this.optionalOperator("=")){var r=this.parseConditional();e=new h.KeyedWrite(e,t,r)}else e=new h.KeyedRead(e,t)}else{if(!this.optionalCharacter(d.$LPAREN))return e;var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN),e=new h.FunctionCall(e,n)}},e.prototype.parsePrimary=function(){if(this.optionalCharacter(d.$LPAREN)){var e=this.parsePipe();return this.expectCharacter(d.$RPAREN),e}if(this.next.isKeywordNull()||this.next.isKeywordUndefined())return this.advance(),new h.LiteralPrimitive(null);if(this.next.isKeywordTrue())return this.advance(),new h.LiteralPrimitive(!0);if(this.next.isKeywordFalse())return this.advance(),new h.LiteralPrimitive(!1);if(this.parseAction&&this.next.isKeywordIf()){this.advance(),this.expectCharacter(d.$LPAREN);var t=this.parseExpression();this.expectCharacter(d.$RPAREN);var r,n=this.parseExpressionOrBlock();return this.next.isKeywordElse()&&(this.advance(),r=this.parseExpressionOrBlock()),new h.If(t,n,r)}if(this.optionalCharacter(d.$LBRACKET)){var i=this.parseExpressionList(d.$RBRACKET);return this.expectCharacter(d.$RBRACKET),new h.LiteralArray(i)}if(this.next.isCharacter(d.$LBRACE))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(g,!1);if(this.next.isNumber()){var o=this.next.toNumber();return this.advance(),new h.LiteralPrimitive(o)}if(this.next.isString()){var a=this.next.toString();return this.advance(),new h.LiteralPrimitive(a)}throw this.error(this.index>=this.tokens.length?"Unexpected end of expression: "+this.input:"Unexpected token "+this.next),new u.BaseException("Fell through all cases in parsePrimary")},e.prototype.parseExpressionList=function(e){var t=[];if(!this.next.isCharacter(e))do t.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return t},e.prototype.parseLiteralMap=function(){var e=[],t=[];if(this.expectCharacter(d.$LBRACE),!this.optionalCharacter(d.$RBRACE)){do{var r=this.expectIdentifierOrKeywordOrString();e.push(r),this.expectCharacter(d.$COLON),t.push(this.parsePipe())}while(this.optionalCharacter(d.$COMMA));this.expectCharacter(d.$RBRACE)}return new h.LiteralMap(e,t)},e.prototype.parseAccessMemberOrMethodCall=function(e,t){void 0===t&&(t=!1);var r=this.expectIdentifierOrKeyword();if(this.optionalCharacter(d.$LPAREN)){var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN);var i=this.reflector.method(r);return t?new h.SafeMethodCall(e,r,i,n):new h.MethodCall(e,r,i,n)}if(!t){if(this.optionalOperator("=")){this.parseAction||this.error("Bindings cannot contain assignments");var o=this.parseConditional();return new h.PropertyWrite(e,r,this.reflector.setter(r),o)}return new h.PropertyRead(e,r,this.reflector.getter(r))}return this.optionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),null):new h.SafePropertyRead(e,r,this.reflector.getter(r))},e.prototype.parseCallArguments=function(){if(this.next.isCharacter(d.$RPAREN))return[];var e=[];do e.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return e},e.prototype.parseExpressionOrBlock=function(){if(this.optionalCharacter(d.$LBRACE)){var e=this.parseBlockContent();return this.expectCharacter(d.$RBRACE),e}return this.parseExpression()},e.prototype.parseBlockContent=function(){this.parseAction||this.error("Binding expression cannot contain chained expression");for(var e=[];this.indexe?"short":"long"}function o(e){for(var t,r={},o=0;o=3?i(a):n(a);break;case"d":r.day=n(a);break;case"E":r.weekday=i(a);break;case"j":r.hour=n(a);break;case"h":r.hour=n(a),r.hour12=!0;break;case"H":r.hour=n(a),r.hour12=!1;break;case"m":r.minute=n(a);break;case"s":r.second=n(a);break;case"z":r.timeZoneName="long";break;case"Z":r.timeZoneName="short"}o=t}return r}var a=System.global,s=a.define;a.define=void 0,function(e){e[e.Decimal=0]="Decimal",e[e.Percent=1]="Percent",e[e.Currency=2]="Currency"}(t.NumberFormatStyle||(t.NumberFormatStyle={}));var c=t.NumberFormatStyle,l=function(){function e(){}return e.format=function(e,t,r,n){var i=void 0===n?{}:n,o=i.minimumIntegerDigits,a=void 0===o?1:o,s=i.minimumFractionDigits,l=void 0===s?0:s,u=i.maximumFractionDigits,p=void 0===u?3:u,d=i.currency,f=i.currencyAsSymbol,h=void 0===f?!1:f,g={minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:p};return g.style=c[r].toLowerCase(),r==c.Currency&&(g.currency=d,g.currencyDisplay=h?"symbol":"code"),new Intl.NumberFormat(t,g).format(e)},e}();t.NumberFormatter=l;var u=new Map,p=function(){function e(){}return e.format=function(e,t,r){var n=t+r;if(u.has(n))return u.get(n).format(e);var i=new Intl.DateTimeFormat(t,o(r));return u.set(n,i),i.format(e)},e}();return t.DateFormatter=p,a.define=s,r.exports}),System.register("angular2/src/core/pipes/uppercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/metadata"),l=e("angular2/src/core/di"),u=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new u.InvalidPipeArgumentException(e,t);return s.StringWrapper.toUpperCase(t)},e=o([s.CONST(),c.Pipe({name:"uppercase"}),l.Injectable(),a("design:paramtypes",[])],e)}();return t.UpperCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/lowercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),l=e("angular2/src/core/metadata"),u=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new u.InvalidPipeArgumentException(e,t);return s.StringWrapper.toLowerCase(t)},e=o([s.CONST(),l.Pipe({name:"lowercase"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.LowerCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/json_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),l=e("angular2/src/core/metadata"),u=function(){function e(){}return e.prototype.transform=function(e,t){return void 0===t&&(t=null),s.Json.stringify(e)},e=o([s.CONST(),l.Pipe({name:"json"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.JsonPipe=u,n.define=i,r.exports}),System.register("angular2/src/core/pipes/slice_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/di"),p=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),d=e("angular2/src/core/metadata"),f=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(r)||0==r.length)throw new c.BaseException("Slice pipe requires one argument");if(!this.supports(t))throw new p.InvalidPipeArgumentException(e,t);if(s.isBlank(t))return t;var n=r[0],i=r.length>1?r[1]:null;return s.isString(t)?s.StringWrapper.slice(t,n,i):l.ListWrapper.slice(t,n,i)},e.prototype.supports=function(e){return s.isString(e)||s.isArray(e)},e=o([d.Pipe({name:"slice"}),u.Injectable(),a("design:paramtypes",[])],e)}();return t.SlicePipe=f,n.define=i,r.exports}),System.register("angular2/src/core/pipes/number_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/intl","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/facade/collection","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/intl"),p=e("angular2/src/core/di"),d=e("angular2/src/core/metadata"),f=e("angular2/src/core/facade/collection"),h=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),g="en-US",m=c.RegExpWrapper.create("^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$"),v=function(){function e(){}return e._format=function(t,r,n,i,o){if(void 0===i&&(i=null),void 0===o&&(o=!1),c.isBlank(t))return null;if(!c.isNumber(t))throw new h.InvalidPipeArgumentException(e,t);var a=1,s=0,p=3;if(c.isPresent(n)){var d=c.RegExpWrapper.firstMatch(m,n);if(c.isBlank(d))throw new l.BaseException(n+" is not a valid digit info for number pipes");c.isPresent(d[1])&&(a=c.NumberWrapper.parseIntAutoRadix(d[1])),c.isPresent(d[3])&&(s=c.NumberWrapper.parseIntAutoRadix(d[3])),c.isPresent(d[5])&&(p=c.NumberWrapper.parseIntAutoRadix(d[5]))}return u.NumberFormatter.format(t,g,r,{minimumIntegerDigits:a,minimumFractionDigits:s,maximumFractionDigits:p,currency:i,currencyAsSymbol:o})},e=a([c.CONST(),p.Injectable(),s("design:paramtypes",[])],e)}();t.NumberPipe=v;var y=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return v._format(e,u.NumberFormatStyle.Decimal,r)},t=a([c.CONST(),d.Pipe({name:"number"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);t.DecimalPipe=y;var _=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return v._format(e,u.NumberFormatStyle.Percent,r)},t=a([c.CONST(),d.Pipe({name:"percent"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);t.PercentPipe=_;var b=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=c.isPresent(t)&&t.length>0?t[0]:"USD",n=c.isPresent(t)&&t.length>1?t[1]:!1,i=c.isPresent(t)&&t.length>2?t[2]:null;return v._format(e,u.NumberFormatStyle.Currency,i,r,n)},t=a([c.CONST(),d.Pipe({name:"currency"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);return t.CurrencyPipe=b,n.define=i,r.exports}),System.register("angular2/src/core/facade",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.Type=o.Type;var a=e("angular2/src/core/facade/async");t.Observable=a.Observable,t.EventEmitter=a.EventEmitter;var s=e("angular2/src/core/facade/exceptions");return t.WrappedException=s.WrappedException,n.define=i,r.exports}),System.register("angular2/src/core/application_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/lang");return t.APP_COMPONENT_REF_PROMISE=a.CONST_EXPR(new o.OpaqueToken("Promise")),t.APP_COMPONENT=a.CONST_EXPR(new o.OpaqueToken("AppComponent")),n.define=i,r.exports}),System.register("angular2/src/core/forms/validators",["angular2/src/core/facade/lang","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/di");t.NG_VALIDATORS=a.CONST_EXPR(new c.OpaqueToken("NgValidators"));var l=function(){function e(){}return e.required=function(e){return o.isBlank(e.value)||""==e.value?{required:!0}:null},e.nullValidator=function(e){return null},e.compose=function(t){return o.isBlank(t)?e.nullValidator:function(e){var r=s.ListWrapper.reduce(t,function(t,r){var n=r(e);return o.isPresent(n)?s.StringMapWrapper.merge(t,n):t},{});return s.StringMapWrapper.isEmpty(r)?null:r}},e.group=function(t){var r={};return s.StringMapWrapper.forEach(t.controls,function(n,i){t.contains(i)&&o.isPresent(n.errors)&&e._mergeErrors(n,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e.array=function(t){var r={};return t.controls.forEach(function(t){o.isPresent(t.errors)&&e._mergeErrors(t,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e._mergeErrors=function(e,t){s.StringMapWrapper.forEach(e.errors,function(r,n){s.StringMapWrapper.contains(t,n)||(t[n]=[]);var i=t[n];i.push(e)})},e}();return t.Validators=l,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/abstract_control_directive",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return Object.defineProperty(e.prototype,"control",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.control.value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this.control.valid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this.control.errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return this.control.pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return this.control.dirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){ +return this.control.touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return this.control.untouched},enumerable:!0,configurable:!0}),e}();return t.AbstractControlDirective=o,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/control_container",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments)}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t}(a.AbstractControlDirective);return t.ControlContainer=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments),this.name=null,this.valueAccessor=null}return o(t,e),Object.defineProperty(t.prototype,"validator",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){},t}(a.AbstractControlDirective);return t.NgControl=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/shared",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/forms/validators"],!0,function(e,t,r){function n(e,t){var r=u.ListWrapper.clone(t.path);return r.push(e),r}function i(e,t){p.isBlank(e)&&o(t,"Cannot find control"),p.isBlank(t.valueAccessor)&&o(t,"No value accessor for"),e.validator=f.Validators.compose([e.validator,t.validator]),t.valueAccessor.writeValue(e.value),t.valueAccessor.registerOnChange(function(r){t.viewToModelUpdate(r),e.updateValue(r,{emitModelToViewChange:!1}),e.markAsDirty()}),e.registerOnChange(function(e){return t.valueAccessor.writeValue(e)}),t.valueAccessor.registerOnTouched(function(){return e.markAsTouched()})}function o(e,t){var r=u.ListWrapper.join(e.path," -> ");throw new d.BaseException(t+" '"+r+"'")}function a(e,t,r,n){e.setElementProperty(t,r,n)}function s(e,t){if(!u.StringMapWrapper.contains(e,"model"))return!1;var r=e.model;return r.isFirstChange()?!0:!p.looseIdentical(t,r.currentValue)}var c=System.global,l=c.define;c.define=void 0;var u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/exceptions"),f=e("angular2/src/core/forms/validators");return t.controlPath=n,t.setUpControl=i,t.setProperty=a,t.isPropertyUpdated=s,c.define=l,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_control",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/validators","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/ng_control"),h=e("angular2/src/core/forms/validators"),g=e("angular2/src/core/forms/directives/shared"),m=l.CONST_EXPR(new d.Binding(f.NgControl,{toAlias:d.forwardRef(function(){return v})})),v=function(e){function t(t){e.call(this),this.update=new u.EventEmitter,this._added=!1,this.validators=t}return o(t,e),t.prototype.onChanges=function(e){this._added||(g.setUpControl(this.form,this),this.form.updateValidity(),this._added=!0),g.isPropertyUpdated(e,this.viewModel)&&(this.form.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return h.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-form-control]",bindings:[m],properties:["form: ngFormControl","model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(h.NG_VALIDATORS)),s("design:paramtypes",[Array])],t)}(f.NgControl);return t.NgFormControl=v,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/model","angular2/src/core/forms/validators","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/ng_control"),h=e("angular2/src/core/forms/model"),g=e("angular2/src/core/forms/validators"),m=e("angular2/src/core/forms/directives/shared"),v=l.CONST_EXPR(new d.Binding(f.NgControl,{toAlias:d.forwardRef(function(){return y})})),y=function(e){function t(t){e.call(this),this._control=new h.Control,this._added=!1,this.update=new u.EventEmitter,this.validators=t}return o(t,e),t.prototype.onChanges=function(e){this._added||(m.setUpControl(this._control,this),this._control.updateValidity(),this._added=!0),m.isPropertyUpdated(e,this.viewModel)&&(this._control.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return g.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-model]:not([ng-control]):not([ng-form-control])",bindings:[v],properties:["model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(g.NG_VALIDATORS)),s("design:paramtypes",[Array])],t)}(f.NgControl);return t.NgModel=y,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_group",["angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/metadata"),u=e("angular2/src/core/di"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/forms/directives/control_container"),f=e("angular2/src/core/forms/directives/shared"),h=p.CONST_EXPR(new u.Binding(d.ControlContainer,{toAlias:u.forwardRef(function(){return g})})),g=function(e){function t(t){e.call(this),this._parent=t}return o(t,e),t.prototype.onInit=function(){this.formDirective.addControlGroup(this)},t.prototype.onDestroy=function(){this.formDirective.removeControlGroup(this)},Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControlGroup(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return f.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),t=a([l.Directive({selector:"[ng-control-group]",bindings:[h],properties:["name: ng-control-group"],exportAs:"form"}),c(0,u.Host()),c(0,u.SkipSelf()),s("design:paramtypes",[d.ControlContainer])],t)}(d.ControlContainer);return t.NgControlGroup=g,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_model",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/shared"),g=c.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return m})})),m=function(e){function t(){e.apply(this,arguments),this.form=null,this.directives=[],this.ngSubmit=new u.EventEmitter}return o(t,e),t.prototype.onChanges=function(e){this._updateDomValue()},Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this.form.find(e.path);h.setUpControl(t,e),t.updateValidity(),this.directives.push(e)},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){l.ListWrapper.remove(this.directives,e)},t.prototype.addControlGroup=function(e){},t.prototype.removeControlGroup=function(e){},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this.form.find(e.path);r.updateValue(t)},t.prototype.onSubmit=function(){return u.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._updateDomValue=function(){var e=this;l.ListWrapper.forEach(this.directives,function(t){var r=e.form.find(t.path);t.valueAccessor.writeValue(r.value)})},t=a([p.Directive({selector:"[ng-form-model]",bindings:[g],properties:["form: ng-form-model"],host:{"(submit)":"onSubmit()"},events:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgFormModel=m,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form",["angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/model","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/async"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/model"),g=e("angular2/src/core/forms/directives/shared"),m=u.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return v})})),v=function(e){function t(){e.apply(this,arguments),this.form=new h.ControlGroup({}),this.ngSubmit=new c.EventEmitter}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controls",{get:function(){return this.form.controls},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.Control;g.setUpControl(i,e),n.addControl(e.name,i),i.updateValidity()})},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);u.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.addControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.ControlGroup({});n.addControl(e.name,i),i.updateValidity()})},t.prototype.removeControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);u.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this;this._later(function(n){var i=r.form.find(e.path);i.updateValue(t)})},t.prototype.onSubmit=function(){return c.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._findContainer=function(e){return l.ListWrapper.removeLast(e),l.ListWrapper.isEmpty(e)?this.form:this.form.find(e)},t.prototype._later=function(e){c.PromiseWrapper.then(c.PromiseWrapper.resolve(null),e,function(e){})},t=a([p.Directive({selector:"form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]",bindings:[m],host:{"(submit)":"onSubmit()"},events:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgForm=v,n.define=i,r.exports}),System.register("angular2/src/core/compiler/component_url_mapper",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/reflection/reflection"),d=function(){function e(){}return e.prototype.getUrl=function(e){return p.reflector.isReflectionEnabled()?p.reflector.importUri(e):"./"},e=a([c.Injectable(),s("design:paramtypes",[])],e)}();t.ComponentUrlMapper=d;var f=function(e){function t(){e.call(this),this._componentUrls=new u.Map}return o(t,e),t.prototype.setComponentUrl=function(e,t){this._componentUrls.set(e,t)},t.prototype.getUrl=function(t){var r=this._componentUrls.get(t);return l.isPresent(r)?r:e.prototype.getUrl.call(this,t)},t}(d);return t.RuntimeComponentUrlMapper=f,n.define=i,r.exports}),System.register("angular2/src/core/compiler/directive_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/metadata","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/reflection/reflection"),f=function(){function e(){}return e.prototype.resolve=function(e){var t=d.reflector.annotations(s.resolveForwardRef(e));if(c.isPresent(t))for(var r=0;r0?l.ListWrapper.removeLast(t):null},e.prototype.returnView=function(e){var t=e.proto,r=this._pooledViewsPerProtoView.get(t);u.isBlank(r)&&(r=[],this._pooledViewsPerProtoView.set(t,r));var n=r.length=0;e--)this.remove(e)},e.prototype.get=function(e){return this._getViews()[e].ref},Object.defineProperty(e.prototype,"length",{get:function(){return this._getViews().length},enumerable:!0,configurable:!0}),e.prototype.createEmbeddedView=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.createEmbeddedViewInContainer(this.element,t,e)},e.prototype.createHostView=function(e,t,r){return void 0===e&&(e=null),void 0===t&&(t=-1),void 0===r&&(r=null),-1==t&&(t=this.length),this.viewManager.createHostViewInContainer(this.element,t,e,r)},e.prototype.insert=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.attachViewInContainer(this.element,t,e)},e.prototype.indexOf=function(e){return o.ListWrapper.indexOf(this._getViews(),s.internalView(e))},e.prototype.remove=function(e){void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.destroyViewInContainer(this.element,e)},e.prototype.detach=function(e){return void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.detachViewInContainer(this.element,e)},e}();return t.ViewContainerRef=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/interfaces",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.OnInit=0]="OnInit",e[e.OnDestroy=1]="OnDestroy",e[e.DoCheck=2]="DoCheck",e[e.OnChanges=3]="OnChanges",e[e.AfterContentInit=4]="AfterContentInit",e[e.AfterContentChecked=5]="AfterContentChecked",e[e.AfterViewInit=6]="AfterViewInit",e[e.AfterViewChecked=7]="AfterViewChecked"}(t.LifecycleHooks||(t.LifecycleHooks={}));var o=t.LifecycleHooks;return t.LIFECYCLE_HOOKS_VALUES=[o.OnInit,o.OnDestroy,o.DoCheck,o.OnChanges,o.AfterContentInit,o.AfterContentChecked,o.AfterViewInit,o.AfterViewChecked],n.define=i,r.exports}),System.register("angular2/src/core/compiler/query_list",["angular2/src/core/facade/collection","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=function(){function e(){this._results=[],this._callbacks=[],this._dirty=!1}return e.prototype.reset=function(e){this._results=e,this._dirty=!0},e.prototype.add=function(e){this._results.push(e),this._dirty=!0},e.prototype.onChange=function(e){this._callbacks.push(e)},e.prototype.removeCallback=function(e){o.ListWrapper.remove(this._callbacks,e)},e.prototype.removeAllCallbacks=function(){this._callbacks=[]},e.prototype.toString=function(){return this._results.toString()},Object.defineProperty(e.prototype,"length",{get:function(){return this._results.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return o.ListWrapper.first(this._results)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return o.ListWrapper.last(this._results)},enumerable:!0,configurable:!0}),e.prototype.map=function(e){return this._results.map(e)},e.prototype[a.getSymbolIterator()]=function(){return this._results[a.getSymbolIterator()]()},e.prototype.fireCallbacks=function(){this._dirty&&(o.ListWrapper.forEach(this._callbacks,function(e){return e()}),this._dirty=!1)},e}();return t.QueryList=s,n.define=i,r.exports}),System.register("angular2/src/core/render/event_config",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.EVENT_TARGET_SEPARATOR=":";var a=function(){function e(e,t,r){this.fieldName=e,this.eventName=t,this.isLongForm=r}return e.parse=function(r){var n=r,i=r,a=!1,s=r.indexOf(t.EVENT_TARGET_SEPARATOR);return s>-1&&(n=o.StringWrapper.substring(r,0,s).trim(),i=o.StringWrapper.substring(r,s+1).trim(),a=!0),new e(n,i,a)},e.prototype.getFullName=function(){return this.isLongForm?""+this.fieldName+t.EVENT_TARGET_SEPARATOR+this.eventName:this.eventName},e}();return t.EventConfig=a,n.define=i,r.exports}),System.register("angular2/src/core/pipes/pipe_binding",["angular2/src/core/di/binding","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/di/binding"),s=e("angular2/src/core/di"),c=function(e){function t(t,r,n,i,o){e.call(this,n,i,o),this.name=t,this.pure=r}return o(t,e),t.createFromType=function(e,r){var n=new s.Binding(e,{toClass:e}),i=a.resolveBinding(n);return new t(r.name,r.pure,i.key,i.resolvedFactories,i.multiBinding)},t}(s.ResolvedBinding);return t.PipeBinding=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/view_resolver",["angular2/src/core/di","angular2/src/core/metadata/view","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/metadata/view"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/reflection/reflection"),f=function(){function e(){this._cache=new p.Map}return e.prototype.resolve=function(e){var t=this._cache.get(e);return l.isBlank(t)&&(t=this._resolve(e),this._cache.set(e,t)),t},e.prototype._resolve=function(e){for(var t=d.reflector.annotations(e),r=0;r0,e.render,t,r,f(o),e.textBindings.length,a);return h(s,o,n),s}function l(e){return x.ListWrapper.map(e,function(e){return u(e.renderProtoView)})}function u(e){var t=new Map;return x.MapWrapper.forEach(e.variableBindings,function(e,r){t.set(r,e)}),t}function p(e){var t=x.ListWrapper.createFixedSize(e.length);return x.ListWrapper.forEach(e,function(e){var r=S.isPresent(e.parentIndex)?t[e.parentIndex]:null;t[e.index]=d(r,e.renderProtoView)}),t}function d(e,t){var r=S.isBlank(e)?[]:x.ListWrapper.clone(e);return x.MapWrapper.forEach(t.variableBindings,function(e,t){r.push(e)}),x.ListWrapper.forEach(t.elementBinders,function(e){x.MapWrapper.forEach(e.variableBindings,function(e,t){r.push(e)})}),r}function f(e){for(var t=new Map,r=0;r0&&s[0].metadata.type===T.RenderDirectiveMetadata.COMPONENT_TYPE&&(c=s[0]);var l=m(n,a,i,c,s);v(e,n,i,l,c,s)}}function g(e,t,r){var n=0;do{var i=r[e];if(e=i.parentIndex,-1!==e){n+=i.distanceToParent;var o=t[e];if(S.isPresent(o.protoElementInjector))return new j(o.protoElementInjector,n)}}while(-1!==e);return new j(null,0)}function m(e,t,r,n,i){var o=null,a=x.MapWrapper.size(r.variableBindings)>0;if(i.length>0||a||S.isPresent(r.nestedProtoView)){var s=y(r,i);o=N.ProtoElementInjector.create(t.protoElementInjector,e,i,S.isPresent(n),t.distance,s),o.attributes=r.readAttributes}return o}function v(e,t,r,n,i,o){var a=null;-1!==r.parentIndex&&(a=e.elementBinders[r.parentIndex]);var s=e.bindElement(a,r.distanceToParent,n,i);return x.MapWrapper.forEach(r.variableBindings,function(t,r){e.protoLocals.set(t,null)}),s}function y(e,t){var r=new Map;return x.MapWrapper.forEach(e.variableBindings,function(n,i){var o=_(e,t,i);r.set(n,o)}),r}function _(e,t,r){for(var n,i=null,o=0;o0?h.ListWrapper.removeAt(i,i.length-1):o++;break;default:i.push(s)}}if(""==t){for(;o-->0;)h.ListWrapper.insert(i,0,"..");0===i.length&&i.push(".")}return t+i.join("/")+r}function a(e){var t=e[m.Path];return t=f.isBlank(t)?"":o(t),e[m.Path]=t,n(e[m.Scheme],e[m.UserInfo],e[m.Domain],e[m.Port],t,e[m.QueryData],e[m.Fragment])}function s(e,t){var r=i(encodeURI(t)),n=i(e);if(f.isPresent(r[m.Scheme]))return a(r);r[m.Scheme]=n[m.Scheme];for(var o=m.Scheme;o<=m.Port;o++)f.isBlank(r[o])&&(r[o]=n[o]);if("/"==r[m.Path][0])return a(r);var s=n[m.Path];f.isBlank(s)&&(s="/");var c=s.lastIndexOf("/");return s=s.substring(0,c+1)+r[m.Path],r[m.Path]=s,a(r)}var c=System.global,l=c.define;c.define=void 0;var u=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/di"),f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/collection"),g=function(){function e(){}return e.prototype.resolve=function(e,t){return s(e,t)},e=u([d.Injectable(),p("design:paramtypes",[])],e)}();t.UrlResolver=g;var m,v=f.RegExpWrapper.create("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");return function(e){e[e.Scheme=1]="Scheme",e[e.UserInfo=2]="UserInfo",e[e.Domain=3]="Domain",e[e.Port=4]="Port",e[e.Path=5]="Path",e[e.QueryData=6]="QueryData",e[e.Fragment=7]="Fragment"}(m||(m={})),c.define=l,r.exports}),System.register("angular2/src/core/services/app_root_url",["angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=function(){function e(e){this._value=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!0,configurable:!0}),e=o([s.Injectable(),a("design:paramtypes",[String])],e)}();return t.AppRootUrl=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/dynamic_component_loader",["angular2/src/core/di","angular2/src/core/compiler/compiler","angular2/src/core/facade/lang","angular2/src/core/compiler/view_manager"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/compiler/compiler"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/compiler/view_manager"),p=function(){function e(e,t,r,n,i){this._dispose=i,this.location=e,this.instance=t,this.componentType=r,this.injector=n}return Object.defineProperty(e.prototype,"hostView",{get:function(){return this.location.parentView},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostComponentType",{get:function(){return this.componentType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostComponent",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._dispose()},e}();t.ComponentRef=p;var d=function(){function e(e,t){this._compiler=e,this._viewManager=t}return e.prototype.loadAsRoot=function(e,t,r,n){var i=this;return this._compiler.compileInHost(e).then(function(o){var a=i._viewManager.createRootHostView(o,t,r),s=i._viewManager.getHostElement(a),c=i._viewManager.getComponent(s),u=function(){i._viewManager.destroyRootHostView(a),l.isPresent(n)&&n()};return new p(s,c,e,r,u)})},e.prototype.loadIntoLocation=function(e,t,r,n){return void 0===n&&(n=null),this.loadNextToLocation(e,this._viewManager.getNamedElementInComponentView(t,r),n)},e.prototype.loadNextToLocation=function(e,t,r){var n=this;return void 0===r&&(r=null),this._compiler.compileInHost(e).then(function(i){var o=n._viewManager.getViewContainer(t),a=o.createHostView(i,o.length,r),s=n._viewManager.getHostElement(a),c=n._viewManager.getComponent(s),l=function(){var e=o.indexOf(a);-1!==e&&o.remove(e)};return new p(s,c,e,null,l)})},e=o([s.Injectable(),a("design:paramtypes",[c.Compiler,u.AppViewManager])],e)}();return t.DynamicComponentLoader=d,n.define=i,r.exports}),System.register("angular2/src/core/render/xhr",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.get=function(e){return null},e}();return t.XHR=o,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/style_url_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/services/url_resolver"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/services/url_resolver"),u=function(){function e(e){this._resolver=e}return e.prototype.resolveUrls=function(e,t){return e=this._replaceUrls(e,p,t),e=this._replaceUrls(e,d,t)},e.prototype._replaceUrls=function(e,t,r){var n=this;return c.StringWrapper.replaceAllMapped(e,t,function(e){var t=e[1],i=e[2];if(c.RegExpWrapper.test(h,i))return e[0];var o=c.StringWrapper.replaceAll(i,f,""),a=e[3],s=n._resolver.resolve(r,o);return t+"'"+s+"'"+a})},e=o([s.Injectable(),a("design:paramtypes",[l.UrlResolver])],e)}();t.StyleUrlResolver=u;var p=/(url\()([^)]*)(\))/g,d=/(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g,f=/['"]/g,h=/^['"]?data:/g;return n.define=i,r.exports}),System.register("angular2/src/core/render/dom/dom_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){return""+i()+i()+i()}function i(){return c.StringWrapper.fromCharCode(97+c.Math.floor(25*c.Math.random()))}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang");return t.DOCUMENT=c.CONST_EXPR(new s.OpaqueToken("DocumentToken")),t.APP_ID=c.CONST_EXPR(new s.OpaqueToken("AppId")),t.APP_ID_RANDOM_BINDING=c.CONST_EXPR(new s.Binding(t.APP_ID,{toFactory:n,deps:[]})),t.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE=c.CONST_EXPR(new s.OpaqueToken("MaxInMemoryElementsPerTemplate")),o.define=a,r.exports}),System.register("angular2/src/core/render/dom/compiler/compile_element",["angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){var t=new l.StringJoiner,r=c.DOM.attributeMap(e);return t.add("<"),t.add(c.DOM.tagName(e).toLowerCase()),i(t,"id",r.get("id")),i(t,"class",r.get("class")),s.MapWrapper.forEach(r,function(e,r){"id"!==r&&"class"!==r&&i(t,r,e)}),t.add(">"),t.toString()}function i(e,t,r){l.isPresent(r)&&e.add(0===r.length?" "+t:" "+t+'="'+r+'"')}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/facade/lang"),u=function(){function e(e,t){void 0===t&&(t=""),this.element=e,this._attrs=null,this._classList=null,this.isViewRoot=!1,this.inheritedProtoView=null,this.distanceToInheritedBinder=0,this.inheritedElementBinder=null,this.compileChildren=!0;var r=l.assertionsEnabled()?n(e):null;""!==t?(this.elementDescription=t,l.isPresent(r)&&(this.elementDescription+=": "+r)):this.elementDescription=r}return e.prototype.isBound=function(){return l.isPresent(this.inheritedElementBinder)&&0===this.distanceToInheritedBinder},e.prototype.bindElement=function(){if(!this.isBound()){var e=this.inheritedElementBinder;this.inheritedElementBinder=this.inheritedProtoView.bindElement(this.element,this.elementDescription),l.isPresent(e)&&this.inheritedElementBinder.setParent(e,this.distanceToInheritedBinder),this.distanceToInheritedBinder=0}return this.inheritedElementBinder},e.prototype.attrs=function(){return l.isBlank(this._attrs)&&(this._attrs=c.DOM.attributeMap(this.element)),this._attrs},e.prototype.classList=function(){if(l.isBlank(this._classList)){this._classList=[];for(var e=c.DOM.classList(this.element),t=0;t0&&a.isBlank(t.element)&&o.ListWrapper.isEmpty(t.classNames)&&o.ListWrapper.isEmpty(t.attrs)&&(t.element="*"),e.push(t)},c=new e,u=a.RegExpWrapper.matcher(l,t),p=c,d=!1;a.isPresent(r=a.RegExpMatcherWrapper.next(u));){if(a.isPresent(r[1])){if(d)throw new s.BaseException("Nesting :not is not allowed in a selector");d=!0,p=new e,c.notSelectors.push(p)}if(a.isPresent(r[2])&&p.setElement(r[2]),a.isPresent(r[3])&&p.addClassName(r[3]),a.isPresent(r[4])&&p.addAttribute(r[4],r[5]),a.isPresent(r[6])&&(d=!1,p=c),a.isPresent(r[7])){if(d)throw new s.BaseException("Multiple selectors in :not are not supported");i(n,c),c=p=new e}}return i(n,c),n},e.prototype.isElementSelector=function(){return a.isPresent(this.element)&&o.ListWrapper.isEmpty(this.classNames)&&o.ListWrapper.isEmpty(this.attrs)&&0===this.notSelectors.length},e.prototype.setElement=function(e){void 0===e&&(e=null),a.isPresent(e)&&(e=e.toLowerCase()),this.element=e},e.prototype.getMatchingElementTemplate=function(){for(var e=a.isPresent(this.element)?this.element:"div",t=this.classNames.length>0?' class="'+this.classNames.join(" ")+'"':"",r="",n=0;n"},e.prototype.addAttribute=function(e,t){void 0===t&&(t=c),this.attrs.push(e.toLowerCase()),t=a.isPresent(t)?t.toLowerCase():c,this.attrs.push(t)},e.prototype.addClassName=function(e){this.classNames.push(e.toLowerCase())},e.prototype.toString=function(){var e="";if(a.isPresent(this.element)&&(e+=this.element),a.isPresent(this.classNames))for(var t=0;t0&&(e+="="+n),e+="]"}return o.ListWrapper.forEach(this.notSelectors,function(t){e+=":not("+t.toString()+")"}),e},e}();t.CssSelector=u;var p=function(){function e(){this._elementMap=new o.Map,this._elementPartialMap=new o.Map,this._classMap=new o.Map,this._classPartialMap=new o.Map,this._attrValueMap=new o.Map,this._attrValuePartialMap=new o.Map,this._listContexts=[]}return e.createNotMatcher=function(t){var r=new e;return r.addSelectables(t,null),r},e.prototype.addSelectables=function(e,t){var r=null;e.length>1&&(r=new d(e),this._listContexts.push(r));for(var n=0;n0&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)){var n=p.createNotMatcher(this.notSelectors);r=!n.match(e,null)}return r&&a.isPresent(t)&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)&&(a.isPresent(this.listContext)&&(this.listContext.alreadyMatched=!0),t(this.selector,this.cbContext)),r},e}();return t.SelectorContext=f,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/view_splitter",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection","angular2/src/core/render/dom/compiler/compile_element","angular2/src/core/render/dom/util"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/dom/dom_adapter"),c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/render/dom/compiler/compile_element"),u=e("angular2/src/core/render/dom/util"),p=function(){function e(e){this._parser=e}return e.prototype.processStyle=function(e){return e},e.prototype.processElement=function(e,t,r){var n=t.attrs(),i=n.get("template"),u=o.isPresent(i);if(c.MapWrapper.forEach(n,function(e,r){if(o.StringWrapper.startsWith(r,"*")){var n=o.StringWrapper.substring(r,1);if(u)throw new a.BaseException("Only one template directive per element is allowed: "+(i+" and "+n+" cannot be used simultaneously ")+("in "+t.elementDescription));i=0==e.length?n:n+" "+e,u=!0}}),o.isPresent(e)){if(s.DOM.isTemplateElement(t.element)&&!t.isViewRoot){var p=new l.CompileElement(s.DOM.createTemplate(""));p.inheritedProtoView=t.bindElement().bindNestedProtoView(p.element),p.elementDescription=t.elementDescription,p.isViewRoot=!0,this._moveChildNodes(s.DOM.content(t.element),s.DOM.content(p.element)),r.addChild(p)}if(u){var d=new l.CompileElement(s.DOM.createTemplate(""));d.inheritedProtoView=t.inheritedProtoView,d.inheritedElementBinder=t.inheritedElementBinder,d.distanceToInheritedBinder=t.distanceToInheritedBinder,d.elementDescription=t.elementDescription;var p=new l.CompileElement(s.DOM.createTemplate(""));p.inheritedProtoView=d.bindElement().bindNestedProtoView(p.element),p.elementDescription=t.elementDescription,p.isViewRoot=!0,t.inheritedProtoView=p.inheritedProtoView,t.inheritedElementBinder=null,t.distanceToInheritedBinder=0,this._parseTemplateBindings(i,d),s.DOM.insertBefore(t.element,d.element),r.addParent(d),s.DOM.appendChild(s.DOM.content(p.element),t.element),r.addParent(p)}}},e.prototype._moveChildNodes=function(e,t){for(var r=s.DOM.firstChild(e);o.isPresent(r);)s.DOM.appendChild(t,r),r=s.DOM.firstChild(e)},e.prototype._parseTemplateBindings=function(e,t){for(var r=this._parser.parseTemplateBindings(e,t.elementDescription),n=0;n","+","~"],i=e,o="["+t+"]",a=0;a0&&!c.ListWrapper.contains(n,t)&&!l.StringWrapper.contains(t,o)){var r=/([^:]*)(:*)(.*)/g,i=l.RegExpWrapper.firstMatch(r,t);l.isPresent(i)&&(e=i[1]+o+i[2]+i[3])}return e}).join(s)}return i},e.prototype._insertPolyfillHostInCssText=function(e){return e=l.StringWrapper.replaceAll(e,P,g),e=l.StringWrapper.replaceAll(e,E,h)},e.prototype._propertiesFromRule=function(e){var t=e.style.cssText,r=/['"]+|attr/g;if(e.style.content.length>0&&!l.isPresent(l.RegExpWrapper.firstMatch(r,e.style.content))){var n=/content:[^;]*;/g;t=l.StringWrapper.replaceAll(t,n,"content: '"+e.style.content+"';")}return t},e}();t.ShadowCss=u;var p=/polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,d=/(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,f=/(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,h="-shadowcsshost",g="-shadowcsscontext",m=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",v=l.RegExpWrapper.create("("+h+m,"im"),y=l.RegExpWrapper.create("("+g+m,"im"),_=h+"-no-combinator",b=[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow-deep\//g,/\/shadow\//g],w="([>\\s~+[.,{:][\\s\\S]*)?$",C=l.RegExpWrapper.create(h,"im"),E=/:host/gim,P=/:host-context/gim;return o.define=a,r.exports}),System.register("angular2/src/core/render/dom/schema/element_schema_registry",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.hasProperty=function(e,t){return!0},e.prototype.getMappedPropName=function(e){return e},e}();return t.ElementSchemaRegistry=o,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/view/proto_view_merger",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/render/dom/view/proto_view","angular2/src/core/render/dom/view/element_binder","angular2/src/core/render/api","angular2/src/core/render/dom/util"],!0,function(e,t,r){function n(e,t){var r=[],n=[];i(e,t,r,n);var c=r[0];s(r,n);var u=[],p=new Set;l(r,n,u,p),o(r);var d=u.map(function(e){return e.length}),f=y(u),h=O.DOM.content(f),g=B.queryBoundElements(h,!1),m=new Map,v=a(r),w=_(h,v,m),C=b(r,g,p,v,m),S=E(r,g),D=P(r,m),I=R(r,n),A=x(n),T=M.DomProtoView.create(e,c.original.type,f,c.original.encapsulation,d,w,C,new Map);return new k.RenderProtoViewMergeMapping(new M.DomProtoViewRef(T),d.length,S,g.length,D,I,A)}function i(e,t,r,n){var o=M.resolveInternalDomProtoView(t[0]),a=r.length;r.push(B.cloneAndQueryProtoView(e,o,!1)),0===n.length&&n.push([null,null]);for(var s=1,c=0;c=1&&O.DOM.appendChild(r,O.DOM.createComment("|")),i.forEach(function(e){O.DOM.appendChild(r,e)})}return t}function _(e,t,r){var n=[];return B.queryBoundTextNodeIndices(e,t,function(e,t,i){n.push(t),r.set(e,r.size)}),n}function b(e,t,r,n,i){for(var o=w(e),a=[],s=0;s=1;r--){var n=e[r];A.isPresent(n)&&(t[n[0]]+=t[r]+1)}return t}function S(e){for(var t=new Map,r=0;r=0&&t>=this.maxInMemoryElementsPerTemplate?u.DOM.getInnerHTML(e):e},e.prototype.cloneContent=function(e,t){var r;return c.isString(e)?(r=u.DOM.content(u.DOM.createTemplate(e)),t&&(r=u.DOM.importIntoDoc(r))):(r=u.DOM.content(e),r=t?u.DOM.importIntoDoc(r):u.DOM.clone(r)),r},e=o([l.Injectable(),s(0,l.Inject(p.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)),a("design:paramtypes",[Object])],e)}();return t.TemplateCloner=d,n.define=i,r.exports}),System.register("angular2/src/animate/css_animation_options",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){this.classesToAdd=[],this.classesToRemove=[],this.animationClasses=[]}return e}();return t.CssAnimationOptions=o,n.define=i,r.exports}),System.register("angular2/src/core/facade/math",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");return t.Math=o.global.Math,t.NaN=typeof t.NaN,n.define=i,r.exports}),System.register("angular2/src/animate/browser_details",["angular2/src/core/di","angular2/src/core/facade/math","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/math"),l=e("angular2/src/core/dom/dom_adapter"),u=function(){function e(){this.elapsedTimeIncludesDelay=!1,this.doesElapsedTimeIncludesDelay()}return e.prototype.doesElapsedTimeIncludesDelay=function(){var e=this,t=l.DOM.createElement("div");l.DOM.setAttribute(t,"style","position: absolute; top: -9999px; left: -9999px; width: 1px;\n height: 1px; transition: all 1ms linear 1ms;"),this.raf(function(r){l.DOM.on(t,"transitionend",function(r){var n=c.Math.round(1e3*r.elapsedTime);e.elapsedTimeIncludesDelay=2==n,l.DOM.remove(t)}),l.DOM.setStyle(t,"width","2px")},2)},e.prototype.raf=function(e,t){void 0===t&&(t=1);var r=new p(e,t);return function(){return r.cancel()}},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();t.BrowserDetails=u;var p=function(){function e(e,t){this.callback=e,this.frames=t,this._raf()}return e.prototype._raf=function(){var e=this;this.currentFrameId=l.DOM.requestAnimationFrame(function(t){return e._nextFrame(t)})},e.prototype._nextFrame=function(e){this.frames--,this.frames>0?this._raf():this.callback(e)},e.prototype.cancel=function(){l.DOM.cancelAnimationFrame(this.currentFrameId),this.currentFrameId=null},e}();return n.define=i,r.exports}),System.register("angular2/src/core/zone/ng_zone",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/profile/profile"),c=function(){function e(e){var t=e.enableLongStackTrace;this._runScope=s.wtfCreateScope("NgZone#run()"),this._microtaskScope=s.wtfCreateScope("NgZone#microtask()"),this._inVmTurnDone=!1,this._pendingTimeouts=[],this._onTurnStart=null,this._onTurnDone=null,this._onEventDone=null,this._onErrorHandler=null,this._pendingMicrotasks=0,this._hasExecutedCodeInInnerZone=!1,this._nestedRun=0,a.global.zone?(this._disabled=!1,this._mountZone=a.global.zone,this._innerZone=this._createInnerZone(this._mountZone,t)):(this._disabled=!0,this._mountZone=null)}return e.prototype.overrideOnTurnStart=function(e){this._onTurnStart=a.normalizeBlank(e)},e.prototype.overrideOnTurnDone=function(e){this._onTurnDone=a.normalizeBlank(e)},e.prototype.overrideOnEventDone=function(e,t){var r=this;void 0===t&&(t=!1);var n=a.normalizeBlank(e);this._onEventDone=t?function(){r._pendingTimeouts.length||n()}:n},e.prototype.overrideOnErrorHandler=function(e){this._onErrorHandler=a.normalizeBlank(e)},e.prototype.run=function(e){if(this._disabled)return e();var t=this._runScope();try{return this._innerZone.run(e)}finally{s.wtfLeave(t)}},e.prototype.runOutsideAngular=function(e){return this._disabled?e():this._mountZone.run(e)},e.prototype._createInnerZone=function(e,t){var r,n=this._microtaskScope,i=this;return r=t?o.StringMapWrapper.merge(Zone.longStackTraceZone,{onError:function(e){i._onError(this,e)}}):{onError:function(e){i._onError(this,e)}},e.fork(r).fork({$run:function(e){return function(){try{return i._nestedRun++,i._hasExecutedCodeInInnerZone||(i._hasExecutedCodeInInnerZone=!0,i._onTurnStart&&e.call(i._innerZone,i._onTurnStart)),e.apply(this,arguments); + +}finally{if(i._nestedRun--,0==i._pendingMicrotasks&&0==i._nestedRun&&!this._inVmTurnDone){if(i._onTurnDone&&i._hasExecutedCodeInInnerZone)try{this._inVmTurnDone=!0,e.call(i._innerZone,i._onTurnDone)}finally{this._inVmTurnDone=!1,i._hasExecutedCodeInInnerZone=!1}0===i._pendingMicrotasks&&a.isPresent(i._onEventDone)&&i.runOutsideAngular(i._onEventDone)}}}},$scheduleMicrotask:function(e){return function(t){i._pendingMicrotasks++;var r=function(){var e=n();try{t()}finally{i._pendingMicrotasks--,s.wtfLeave(e)}};e.call(this,r)}},$setTimeout:function(e){return function(t,r){for(var n=[],a=2;a1?e[1]:null;return this.control(t,r)}return this.control(e)},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.FormBuilder=p,n.define=i,r.exports}),System.register("angular2/src/core/dom/generic_browser_adapter",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/collection"),s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/dom/dom_adapter"),l=function(e){function t(){var t=this;e.call(this),this._animationPrefix=null,this._transitionEnd=null;try{var r=this.createElement("div",this.defaultDoc());if(s.isPresent(this.getStyle(r,"animationName")))this._animationPrefix="";else for(var n=["Webkit","Moz","O","ms"],i=0;i=200&&300>=i?t.resolve(n):t.reject("Failed to load "+e,null)},r.onerror=function(){t.reject("Failed to load "+e,null)},r.send(),t.promise},t=a([c.Injectable(),s("design:paramtypes",[])],t)}(p.XHR);return t.XHRImpl=d,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/key_events",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/render/dom/events/event_manager","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/render/dom/events/event_manager"),d=e("angular2/src/core/di"),f=["alt","control","meta","shift"],h={alt:function(e){return e.altKey},control:function(e){return e.ctrlKey},meta:function(e){return e.metaKey},shift:function(e){return e.shiftKey}},g=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return l.isPresent(t.parseEventName(e))},t.prototype.addEventListener=function(e,r,n){var i=t.parseEventName(r),o=t.eventCallback(e,u.StringMapWrapper.get(i,"fullKey"),n,this.manager.getZone());this.manager.getZone().runOutsideAngular(function(){c.DOM.on(e,u.StringMapWrapper.get(i,"domEventName"),o)})},t.parseEventName=function(e){var r=e.toLowerCase().split("."),n=u.ListWrapper.removeAt(r,0);if(0===r.length||!l.StringWrapper.equals(n,"keydown")&&!l.StringWrapper.equals(n,"keyup"))return null;var i=t._normalizeKey(u.ListWrapper.removeLast(r)),o="";if(u.ListWrapper.forEach(f,function(e){u.ListWrapper.contains(r,e)&&(u.ListWrapper.remove(r,e),o+=e+".")}),o+=i,0!=r.length||0===i.length)return null;var a=u.StringMapWrapper.create();return u.StringMapWrapper.set(a,"domEventName",n),u.StringMapWrapper.set(a,"fullKey",o),a},t.getEventFullKey=function(e){var t="",r=c.DOM.getEventKey(e);return r=r.toLowerCase(),l.StringWrapper.equals(r," ")?r="space":l.StringWrapper.equals(r,".")&&(r="dot"),u.ListWrapper.forEach(f,function(n){if(n!=r){var i=u.StringMapWrapper.get(h,n);i(e)&&(t+=n+".")}}),t+=r},t.eventCallback=function(e,r,n,i){return function(e){l.StringWrapper.equals(t.getEventFullKey(e),r)&&i.run(function(){return n(e)})}},t._normalizeKey=function(e){switch(e){case"esc":return"escape";default:return e}},t=a([d.Injectable(),s("design:paramtypes",[])],t)}(p.EventManagerPlugin);return t.KeyEventsPlugin=g,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/hammer_common",["angular2/src/core/render/dom/events/event_manager","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/render/dom/events/event_manager"),s=e("angular2/src/core/facade/collection"),c={pan:!0,panstart:!0,panmove:!0,panend:!0,pancancel:!0,panleft:!0,panright:!0,panup:!0,pandown:!0,pinch:!0,pinchstart:!0,pinchmove:!0,pinchend:!0,pinchcancel:!0,pinchin:!0,pinchout:!0,press:!0,pressup:!0,rotate:!0,rotatestart:!0,rotatemove:!0,rotateend:!0,rotatecancel:!0,swipe:!0,swipeleft:!0,swiperight:!0,swipeup:!0,swipedown:!0,tap:!0},l=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return e=e.toLowerCase(),s.StringMapWrapper.contains(c,e)},t}(a.EventManagerPlugin);return t.HammerGesturesPluginCommon=l,n.define=i,r.exports}),System.register("angular2/src/core/services/anchor_based_app_root_url",["angular2/src/core/services/app_root_url","angular2/src/core/dom/dom_adapter","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/services/app_root_url"),l=e("angular2/src/core/dom/dom_adapter"),u=e("angular2/src/core/di"),p=function(e){function t(){e.call(this,"");var t,r=l.DOM.createElement("a");l.DOM.resolveAndSetHref(r,"./",null),t=l.DOM.getHref(r),this.value=t}return o(t,e),t=a([u.Injectable(),s("design:paramtypes",[])],t)}(c.AppRootUrl);return t.AnchorBasedAppRootUrl=p,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/render/dom/schema/element_schema_registry"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/render/dom/schema/element_schema_registry"),u=function(e){function t(){e.apply(this,arguments),this._protoElements=new Map}return o(t,e),t.prototype._getProtoElement=function(e){var t=this._protoElements.get(e);return a.isBlank(t)&&(t=c.DOM.createElement(e),this._protoElements.set(e,t)),t},t.prototype.hasProperty=function(e,t){if(-1!==e.indexOf("-"))return!0;var r=this._getProtoElement(e);return c.DOM.hasProperty(r,t)},t.prototype.getMappedPropName=function(e){var t=s.StringMapWrapper.get(c.DOM.attrToPropMap,e);return a.isPresent(t)?t:e},t}(l.ElementSchemaRegistry);return t.DomElementSchemaRegistry=u,n.define=i,r.exports}),System.register("angular2/src/core/platform_bindings",["angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/dom/dom_adapter");return t.EXCEPTION_BINDING=o.bind(a.ExceptionHandler).toFactory(function(){return new a.ExceptionHandler(s.DOM,!1)},[]),n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_init",[],!0,function(e,t,r){function n(){}var i=System.global,o=i.define;return i.define=void 0,t.wtfInit=n,i.define=o,r.exports}),System.register("angular2/src/core/life_cycle/life_cycle",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/profile/profile"),p=function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=!1),this._runningTick=!1,this._changeDetectors=[],c.isPresent(e)&&this._changeDetectors.push(e),this._enforceNoNewChanges=t}return e.prototype.registerWith=function(e,t){var r=this;void 0===t&&(t=null),c.isPresent(t)&&this._changeDetectors.push(t),e.overrideOnTurnDone(function(){return r.tick()})},e.prototype.tick=function(){if(this._runningTick)throw new l.BaseException("LifeCycle.tick is called recursively");var t=e._tickScope();try{this._runningTick=!0,this._changeDetectors.forEach(function(e){return e.detectChanges()}),this._enforceNoNewChanges&&this._changeDetectors.forEach(function(e){return e.checkNoChanges()})}finally{this._runningTick=!1,u.wtfLeave(t)}},e._tickScope=u.wtfCreateScope("LifeCycle#tick()"),e=o([s.Injectable(),a("design:paramtypes",[Object,Boolean])],e)}();return t.LifeCycle=p,n.define=i,r.exports}),System.register("angular2/src/core/compiler/template_commands",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){return new y(e,t,r)}function i(e){return new _(e)}function o(e,t,r,n,i,o,a){return new b(e,t,r,n,i,o,a)}function a(){return new w}function s(e,t,r,n,i,o,a,s){return new C(e,t,r,n,i,o,a,s)}function c(){return new E}function l(e,t,r,n,i,o,a){return new P(e,t,r,n,i,o,a)}function u(e,t,r){void 0===r&&(r=null);for(var n=0;n "+r+" ).toList()":".map(function("+e.join(",")+") { return "+r+"; })"}function p(e,r){return t.IS_DART?".replaceAll('"+e+"', '"+r+"')":".replace(/"+e+"/g, '"+r+"')"}function d(e,r){return t.IS_DART?"("+e.join(",")+") => "+r:"function("+e.join(",")+") { return "+r+"; }"}function f(e,t){var r=m.StringWrapper.split(e.trim(),/\s*:\s*/g);return r.length>1?r:t}var h=System.global,g=h.define;h.define=void 0;var m=e("angular2/src/core/facade/lang"),v=/([A-Z])/g,y=/-([a-z])/g,_=/'|\\|\n|\$/g,b=/"|\\|\n|\$/g;return t.IS_DART=!m.isJsObject({}),t.camelCaseToDashCase=n,t.dashCaseToCamelCase=i,t.escapeSingleQuoteString=o,t.escapeDoubleQuoteString=a,t.codeGenExportVariable=c,t.codeGenConcatArray=l,t.codeGenMapArray=u,t.codeGenReplaceAll=p,t.codeGenValueFn=d,t.splitAtColon=f,h.define=g,r.exports}),System.register("angular2/src/compiler/source_module",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return"#MODULE["+e+"]"}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=/#MODULE\[([^\]]*)\]/g;t.moduleRef=n;var c=function(){function e(e,t){this.moduleId=e,this.sourceWithModuleRefs=t}return e.prototype.getSourceWithImports=function(){var e=this,t={},r=[],n=a.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs,s,function(n){var i=n[1],o=t[i];return a.isBlank(o)&&(i==e.moduleId?o="":(o="import"+r.length,r.push([i,o])),t[i]=o),o.length>0?o+".":""});return new p(n,r)},e}();t.SourceModule=c;var l=function(){function e(e,t){this.declarations=e,this.expression=t}return e}();t.SourceExpression=l;var u=function(){function e(e,t){this.declarations=e,this.expressions=t}return e}();t.SourceExpressions=u;var p=function(){function e(e,t){this.source=e,this.imports=t}return e}();return t.SourceWithImports=p,i.define=o,r.exports}),System.register("angular2/src/compiler/template_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.TextAst=s;var c=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitBoundText(this,t)},e}();t.BoundTextAst=c;var l=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.AttrAst=l;var u=function(){function e(e,t,r,n,i){this.name=e,this.type=t,this.value=r,this.unit=n,this.sourceInfo=i}return e.prototype.visit=function(e,t){return e.visitElementProperty(this,t)},e}();t.BoundElementPropertyAst=u;var p=function(){function e(e,t,r,n){this.name=e,this.target=t,this.handler=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitEvent(this,t)},Object.defineProperty(e.prototype,"fullName",{get:function(){return a.isPresent(this.target)?this.target+":"+this.name:this.name},enumerable:!0,configurable:!0}),e}();t.BoundEventAst=p;var d=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitVariable(this,t)},e}();t.VariableAst=d;var f=function(){function e(e,t,r,n,i,o,a,s,c){this.name=e,this.attrs=t,this.properties=r,this.events=n,this.exportAsVars=i,this.directives=o,this.children=a,this.ngContentIndex=s,this.sourceInfo=c}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e.prototype.isBound=function(){return this.properties.length>0||this.events.length>0||this.exportAsVars.length>0||this.directives.length>0},e.prototype.getComponent=function(){return this.directives.length>0&&this.directives[0].directive.isComponent?this.directives[0].directive:null},e}();t.ElementAst=f;var h=function(){function e(e,t,r,n,i,o){this.attrs=e,this.vars=t,this.directives=r,this.children=n,this.ngContentIndex=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitEmbeddedTemplate(this,t)},e}();t.EmbeddedTemplateAst=h;var g=function(){function e(e,t,r,n){this.directiveName=e,this.templateName=t,this.value=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitDirectiveProperty(this,t)},e}();t.BoundDirectivePropertyAst=g;var m=function(){function e(e,t,r,n,i,o){this.directive=e,this.properties=t,this.hostProperties=r,this.hostEvents=n,this.exportAsVars=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitDirective(this,t)},e}();t.DirectiveAst=m;var v=function(){function e(e,t){this.ngContentIndex=e,this.sourceInfo=t}return e.prototype.visit=function(e,t){return e.visitNgContent(this,t)},e}();return t.NgContentAst=v,function(e){e[e.Property=0]="Property",e[e.Attribute=1]="Attribute",e[e.Class=2]="Class",e[e.Style=3]="Style"}(t.PropertyBindingType||(t.PropertyBindingType={})),t.PropertyBindingType,t.templateVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/transform/template_compiler/change_detector_codegen",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e){}return e.prototype.generate=function(e,t,r){throw"Not implemented in JS"},e.prototype.toString=function(){throw"Not implemented in JS"},e}();return t.Codegen=o,n.define=i,r.exports}),System.register("angular2/src/compiler/style_url_resolver",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){var n=[];return r=i(e,t,r,n),r=o(e,t,r),new l(r,n)}function i(e,t,r,n){return c.StringWrapper.replaceAllMapped(r,p,function(r){var i=c.isPresent(r[1])?r[1]:r[2];return n.push(e.resolve(t,i)),""})}function o(e,t,r){return c.StringWrapper.replaceAllMapped(r,u,function(r){var n=r[1],i=r[2];if(c.RegExpWrapper.test(f,i))return r[0];var o=c.StringWrapper.replaceAll(i,d,""),a=r[3],s=e.resolve(t,o);return n+"'"+s+"'"+a})}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/facade/lang");t.resolveStyleUrls=n;var l=function(){function e(e,t){this.style=e,this.styleUrls=t}return e}();t.StyleWithImports=l;var u=/(url\()([^)]*)(\))/g,p=/@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g,d=/['"]/g,f=/^['"]?data:/g;return a.define=s,r.exports}),System.register("angular2/src/compiler/command_compiler",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/compiler/template_commands","angular2/src/compiler/template_ast","angular2/src/compiler/source_module","angular2/src/core/render/api","angular2/src/compiler/style_compiler","angular2/src/compiler/util","angular2/src/core/di"],!0,function(e,t,r){function n(e){return"["+e.map(function(e){return p.isString(e)?y.escapeSingleQuoteString(e):p.isBlank(e)?"null":e}).join(",")+"]"}function i(e){return e.map(function(e){return""+g.moduleRef(e.type.moduleId)+e.type.name})}function o(e,t,r){return h.templateVisitAll(e,t,r),r}function a(e){for(var t=new Set,r=[],n=0;n0,a=[];t.vars.forEach(function(e){a.push(e.name),a.push(e.value.length>0?e.value:b)});var s=[];return d.ListWrapper.forEachWithIndex(t.directives,function(e,t){e.visit(n,new R(t,[],[],s))}),this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex,this._readAttrNameAndValues(null,s,t.attrs),a,s,o,t.ngContentIndex,i.result)),this.transitiveNgContentCount+=i.transitiveNgContentCount,this.embeddedTemplateIndex=i.embeddedTemplateIndex,null},e.prototype.visitElement=function(e,t){var r=this,n=e.getComponent(),i=o(this,e.events,[]),s=[];p.isBlank(n)&&e.exportAsVars.forEach(function(e){s.push(e.name),s.push(null)});var c=[];d.ListWrapper.forEachWithIndex(e.directives,function(e,t){e.visit(r,new R(t,i,s,c))}),i=a(i);var l=this._readAttrNameAndValues(n,c,e.attrs);return p.isPresent(n)?(this.result.push(this.commandFactory.createBeginComponent(e.name,l,i,s,c,n.template.encapsulation===m.ViewEncapsulation.Native,e.ngContentIndex)),h.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndComponent())):(this.result.push(this.commandFactory.createBeginElement(e.name,l,i,s,c,e.isBound(),e.ngContentIndex)),h.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndElement())),null},e.prototype.visitVariable=function(e,t){return null},e.prototype.visitAttr=function(e,t){return t.push(e.name),t.push(e.value),null},e.prototype.visitBoundText=function(e,t){return this.result.push(this.commandFactory.createText(null,!0,e.ngContentIndex)),null},e.prototype.visitText=function(e,t){return this.result.push(this.commandFactory.createText(e.value,!1,e.ngContentIndex)),null},e.prototype.visitDirective=function(e,t){return t.targetDirectives.push(e.directive),h.templateVisitAll(this,e.hostEvents,t.eventTargetAndNames),e.exportAsVars.forEach(function(e){t.targetVariableNameAndValues.push(e.name),t.targetVariableNameAndValues.push(t.index)}),null},e.prototype.visitEvent=function(e,t){return t.push(e.target),t.push(e.name),null},e.prototype.visitDirectiveProperty=function(e,t){return null},e.prototype.visitElementProperty=function(e,t){return null},e}(),R=function(){function e(e,t,r,n){this.index=e,this.eventTargetAndNames=t,this.targetVariableNameAndValues=r,this.targetDirectives=n}return e}();return s.define=c,r.exports}),System.register("angular2/src/compiler/html_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t){this.value=e,this.sourceInfo=t}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.HtmlTextAst=s;var c=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.HtmlAttrAst=c;var l=function(){function e(e,t,r,n){this.name=e,this.attrs=t,this.children=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e}();return t.HtmlElementAst=l,t.htmlVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/compiler/template_preparser",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){var t=null,r=null,n=null,o=!1;e.attrs.forEach(function(e){e.name==c?t=e.value:e.name==d?r=e.value:e.name==p?n=e.value:e.name==m&&(o=!0)}),t=i(t);var a=e.name,s=v.OTHER;return a==l?s=v.NG_CONTENT:a==h?s=v.STYLE:a==g?s=v.SCRIPT:a==u&&n==f&&(s=v.STYLESHEET),new y(s,t,r,o)}function i(e){return s.isBlank(e)||0===e.length?"*":e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang"),c="select",l="ng-content",u="link",p="rel",d="href",f="stylesheet",h="style",g="script",m="ng-non-bindable";t.preparseElement=n,function(e){e[e.NG_CONTENT=0]="NG_CONTENT",e[e.STYLE=1]="STYLE",e[e.STYLESHEET=2]="STYLESHEET",e[e.SCRIPT=3]="SCRIPT",e[e.OTHER=4]="OTHER"}(t.PreparsedElementType||(t.PreparsedElementType={}));var v=t.PreparsedElementType,y=function(){function e(e,t,r,n){this.type=e,this.selectAttr=t,this.hrefAttr=r,this.nonBindable=n}return e}();return t.PreparsedElement=y,o.define=a,r.exports}),System.register("angular2/src/compiler/template_normalizer",["angular2/src/compiler/directive_metadata","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/async","angular2/src/core/render/xhr","angular2/src/core/services/url_resolver","angular2/src/compiler/style_url_resolver","angular2/src/core/di","angular2/src/core/render/api","angular2/src/compiler/html_ast","angular2/src/compiler/html_parser","angular2/src/compiler/template_preparser"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/compiler/directive_metadata"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/render/xhr"),d=e("angular2/src/core/services/url_resolver"),f=e("angular2/src/compiler/style_url_resolver"),h=e("angular2/src/core/di"),g=e("angular2/src/core/render/api"),m=e("angular2/src/compiler/html_ast"),v=e("angular2/src/compiler/html_parser"),y=e("angular2/src/compiler/template_preparser"),_=function(){function e(e,t,r){this._xhr=e,this._urlResolver=t,this._domParser=r}return e.prototype.normalizeTemplate=function(e,t){var r=this;if(c.isPresent(t.template))return u.PromiseWrapper.resolve(this.normalizeLoadedTemplate(e,t,t.template,e.moduleId));if(c.isPresent(t.templateUrl)){var n=this._urlResolver.resolve(e.moduleId,t.templateUrl);return this._xhr.get(n).then(function(i){return r.normalizeLoadedTemplate(e,t,i,n)})}throw new l.BaseException("No template specified for component "+e.name)},e.prototype.normalizeLoadedTemplate=function(e,t,r,n){var i=this,o=this._domParser.parse(r,e.name),a=new b;m.htmlVisitAll(a,o);var c=t.styles.concat(a.styles),l=a.styleUrls.map(function(e){return i._urlResolver.resolve(n,e)}).concat(t.styleUrls.map(function(t){return i._urlResolver.resolve(e.moduleId,t)})),u=c.map(function(e){var t=f.resolveStyleUrls(i._urlResolver,n,e);return t.styleUrls.forEach(function(e){return l.push(e)}),t.style}),p=t.encapsulation;return p===g.ViewEncapsulation.Emulated&&0===u.length&&0===l.length&&(p=g.ViewEncapsulation.None),new s.CompileTemplateMetadata({encapsulation:p,template:r,templateUrl:n,styles:u,styleUrls:l,ngContentSelectors:a.ngContentSelectors})},e=o([h.Injectable(),a("design:paramtypes",[p.XHR,d.UrlResolver,v.HtmlParser])],e)}();t.TemplateNormalizer=_;var b=function(){function e(){this.ngContentSelectors=[],this.styles=[],this.styleUrls=[],this.ngNonBindableStackCount=0}return e.prototype.visitElement=function(e,t){var r=y.preparseElement(e);switch(r.type){case y.PreparsedElementType.NG_CONTENT:0===this.ngNonBindableStackCount&&this.ngContentSelectors.push(r.selectAttr);break;case y.PreparsedElementType.STYLE:var n="";e.children.forEach(function(e){e instanceof m.HtmlTextAst&&(n+=e.value)}),this.styles.push(n);break;case y.PreparsedElementType.STYLESHEET:this.styleUrls.push(r.hrefAttr)}return r.nonBindable&&this.ngNonBindableStackCount++,m.htmlVisitAll(this,e.children),r.nonBindable&&this.ngNonBindableStackCount--,null},e.prototype.visitAttr=function(e,t){return null},e.prototype.visitText=function(e,t){return null},e}();return n.define=i,r.exports}),System.register("angular2/src/compiler/runtime_metadata",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/compiler/directive_metadata","angular2/src/core/metadata/directives","angular2/src/core/compiler/directive_resolver","angular2/src/core/compiler/view_resolver","angular2/src/core/compiler/directive_lifecycle_reflector","angular2/src/core/compiler/interfaces","angular2/src/core/reflection/reflection","angular2/src/core/di"],!0,function(e,t,r){function n(e){var t=new Map;return e.forEach(function(e){t.set(e.type.id,e)}),g.MapWrapper.values(t)}function i(e){if(f.isBlank(e.directives))return[];var t=[];return o(e.directives,t),t}function o(e,t){for(var r=0;r0&&this._renderer.setElementClass(this._ngEl,e,t)},e=o([c.Directive({selector:"[ng-class]",properties:["rawClass: ng-class","initialClasses: class"]}),a("design:paramtypes",[u.IterableDiffers,u.KeyValueDiffers,l.ElementRef,p.Renderer])],e)}();return t.NgClass=f,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_for",["angular2/src/core/metadata","angular2/src/core/change_detection","angular2/src/core/compiler","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/change_detection"),l=e("angular2/src/core/compiler"),u=e("angular2/src/core/facade/lang"),p=function(){function e(e,t,r,n){this._viewContainer=e,this._templateRef=t,this._iterableDiffers=r,this._cdr=n}return Object.defineProperty(e.prototype,"ngForOf",{set:function(e){this._ngForOf=e,u.isBlank(this._differ)&&u.isPresent(e)&&(this._differ=this._iterableDiffers.find(e).create(this._cdr))},enumerable:!0,configurable:!0}),e.prototype.doCheck=function(){if(u.isPresent(this._differ)){var e=this._differ.diff(this._ngForOf);u.isPresent(e)&&this._applyChanges(e)}},e.prototype._applyChanges=function(e){var t=[];e.forEachRemovedItem(function(e){return t.push(new d(e,null))}),e.forEachMovedItem(function(e){return t.push(new d(e,null))});var r=this._bulkRemove(t);e.forEachAddedItem(function(e){return r.push(new d(e,null))}),this._bulkInsert(r);for(var n=0;nn;n++)this._viewContainer.get(n).setLocal("last",n===i-1)},e.prototype._perViewChange=function(e,t){e.setLocal("$implicit",t.item),e.setLocal("index",t.currentIndex),e.setLocal("even",t.currentIndex%2==0),e.setLocal("odd",t.currentIndex%2==1)},e.prototype._bulkRemove=function(e){e.sort(function(e,t){return e.record.previousIndex-t.record.previousIndex});for(var t=[],r=e.length-1;r>=0;r--){var n=e[r];u.isPresent(n.record.currentIndex)?(n.view=this._viewContainer.detach(n.record.previousIndex),t.push(n)):this._viewContainer.remove(n.record.previousIndex)}return t},e.prototype._bulkInsert=function(e){e.sort(function(e,t){return e.record.currentIndex-t.record.currentIndex});for(var t=0;t0?r[0]:null},e.prototype.queryAll=function(e,t){void 0===t&&(t=d.all);var r=t(this);return c.ListWrapper.filter(r,e)},e.prototype._getChildElements=function(t,r){var n=this,i=[],o=null;s.isPresent(r)&&(o=t.proto.elementBinders[r-t.elementOffset]);for(var a=0;ae},e.operation_greater_then=function(e,t){return e>t},e.operation_less_or_equals_then=function(e,t){return t>=e},e.operation_greater_or_equals_then=function(e,t){return e>=t},e.operation_logical_and=function(e,t){return e&&t},e.operation_logical_or=function(e,t){return e||t},e.cond=function(e,t,r){return e?t:r},e.mapFn=function(e){function t(t){for(var r=c.StringMapWrapper.create(),n=0;nt?null:e[t-1]},e.callPipeOnDestroy=function(e){u.implementsOnDestroy(e.pipe)&&e.pipe.onDestroy()},e.bindingTarget=function(e,t,r,n,i){return new p.BindingTarget(e,t,r,n,i)},e.directiveIndex=function(e,t){return new d.DirectiveIndex(e,t)},e.uninitialized=a.CONST_EXPR(new Object),e}();return t.ChangeDetectionUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/profile/profile",["angular2/src/core/profile/wtf_impl"],!0,function(e,t,r){function n(e,t){return null}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/profile/wtf_impl");return t.wtfEnabled=a.detectWTF(),t.wtfCreateScope=t.wtfEnabled?a.createScope:function(e,t){return n},t.wtfLeave=t.wtfEnabled?a.leave:function(e,t){return t},t.wtfStartTimeRange=t.wtfEnabled?a.startTimeRange:function(e,t){return null},t.wtfEndTimeRange=t.wtfEnabled?a.endTimeRange:function(e){return null},i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_logic_util",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_record","angular2/src/core/change_detection/constants","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/change_detection/codegen_facade"),c=e("angular2/src/core/change_detection/proto_record"),l=e("angular2/src/core/change_detection/constants"),u=e("angular2/src/core/facade/exceptions"),p=function(){function e(e,t,r){this._names=e,this._utilName=t,this._changeDetection=r}return e.prototype.genPropertyBindingEvalValue=function(e){var t=this;return this._genEvalValue(e,function(e){return t._names.getLocalName(e)},this._names.getLocalsAccessorName())},e.prototype.genEventBindingEvalValue=function(e,t){var r=this;return this._genEvalValue(t,function(t){return r._names.getEventLocalName(e,t)},"locals")},e.prototype._genEvalValue=function(e,t,r){var n,i=-1==e.contextIndex?this._names.getDirectiveName(e.directiveIndex):t(e.contextIndex),a=o.ListWrapper.map(e.args,function(e){return t(e)}).join(", ");switch(e.mode){case c.RecordType.Self:n=i;break;case c.RecordType.Const:n=s.codify(e.funcOrValue);break;case c.RecordType.PropertyRead:n=this._observe(i+"."+e.name,e);break;case c.RecordType.SafeProperty:var l=this._observe(i+"."+e.name,e);n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(l,e);break;case c.RecordType.PropertyWrite:n=i+"."+e.name+" = "+t(e.args[0]);break;case c.RecordType.Local:n=this._observe(r+".get("+s.rawString(e.name)+")",e);break;case c.RecordType.InvokeMethod:n=this._observe(i+"."+e.name+"("+a+")",e);break;case c.RecordType.SafeMethodInvoke:var p=i+"."+e.name+"("+a+")";n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(p,e);break;case c.RecordType.InvokeClosure:n=i+"("+a+")";break;case c.RecordType.PrimitiveOp:n=this._utilName+"."+e.name+"("+a+")";break;case c.RecordType.CollectionLiteral:n=this._utilName+"."+e.name+"("+a+")";break;case c.RecordType.Interpolate:n=this._genInterpolation(e);break;case c.RecordType.KeyedRead:n=this._observe(i+"["+t(e.args[0])+"]",e);break;case c.RecordType.KeyedWrite:n=i+"["+t(e.args[0])+"] = "+t(e.args[1]);break;case c.RecordType.Chain:n="null";break;default:throw new u.BaseException("Unknown operation "+e.mode)}return t(e.selfIndex)+" = "+n+";"},e.prototype._observe=function(e,t){return this._changeDetection===l.ChangeDetectionStrategy.OnPushObserve?"this.observeValue("+e+", "+t.selfIndex+")":e},e.prototype.genPropertyBindingTargets=function(e,t){var r=this,n=e.map(function(e){if(a.isBlank(e))return"null";var n=t?s.codify(e.debug):"null";return r._utilName+".bindingTarget("+s.codify(e.mode)+", "+e.elementIndex+", "+s.codify(e.name)+", "+s.codify(e.unit)+", "+n+")"});return"["+n.join(", ")+"]"},e.prototype.genDirectiveIndices=function(e){var t=this,r=e.map(function(e){return t._utilName+".directiveIndex("+e.directiveIndex.elementIndex+", "+e.directiveIndex.directiveIndex+")"});return"["+r.join(", ")+"]"},e.prototype._genInterpolation=function(e){for(var t=[],r=0;r=0;--r){var n=e[r];n.callAfterContentInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterContentInit();"),n.callAfterContentChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterContentChecked();")}return t},e.prototype.genViewLifecycleCallbacks=function(e){for(var t=[],r=e.length-1;r>=0;--r){var n=e[r];n.callAfterViewInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterViewInit();"),n.callAfterViewChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterViewChecked();")}return t},e}();return t.CodegenLogicUtil=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/proto_change_detector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/ast","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/dynamic_change_detector","angular2/src/core/change_detection/directive_record","angular2/src/core/change_detection/event_binding","angular2/src/core/change_detection/coalesce","angular2/src/core/change_detection/proto_record"],!0,function(e,t,r){function n(e){var t=new P;return g.ListWrapper.forEachWithIndex(e.bindingRecords,function(r,n){return t.add(r,e.variableNames,n)}),w.coalesce(t.records)}function i(e){var t=g.ListWrapper.concat(["$event"],e.variableNames);return e.eventRecords.map(function(e){var r=R.create(e,t),n=e.implicitReceiver instanceof _.DirectiveIndex?e.implicitReceiver:null;return new b.EventBinding(e.target.name,e.target.elementIndex,n,r)})}function o(e){switch(e){case 0:return v.ChangeDetectionUtil.arrayFn0;case 1:return v.ChangeDetectionUtil.arrayFn1;case 2:return v.ChangeDetectionUtil.arrayFn2;case 3:return v.ChangeDetectionUtil.arrayFn3;case 4:return v.ChangeDetectionUtil.arrayFn4;case 5:return v.ChangeDetectionUtil.arrayFn5;case 6:return v.ChangeDetectionUtil.arrayFn6;case 7:return v.ChangeDetectionUtil.arrayFn7;case 8:return v.ChangeDetectionUtil.arrayFn8;case 9:return v.ChangeDetectionUtil.arrayFn9;default:throw new h.BaseException("Does not support literal maps with more than 9 elements")}}function a(e){var t=g.ListWrapper.join(g.ListWrapper.map(e,function(e){return f.isString(e)?'"'+e+'"':""+e}),", ");return"mapFn(["+t+"])"}function s(e){switch(e){case"+":return"operation_add";case"-":return"operation_subtract";case"*":return"operation_multiply";case"/":return"operation_divide";case"%":return"operation_remainder";case"==":return"operation_equals";case"!=":return"operation_not_equals";case"===":return"operation_identical";case"!==":return"operation_not_identical";case"<":return"operation_less_then";case">":return"operation_greater_then";case"<=":return"operation_less_or_equals_then";case">=":return"operation_greater_or_equals_then";case"&&":return"operation_logical_and";case"||":return"operation_logical_or";default:throw new h.BaseException("Unsupported operation "+e)}}function c(e){switch(e){case"+":return v.ChangeDetectionUtil.operation_add;case"-":return v.ChangeDetectionUtil.operation_subtract;case"*":return v.ChangeDetectionUtil.operation_multiply;case"/":return v.ChangeDetectionUtil.operation_divide;case"%":return v.ChangeDetectionUtil.operation_remainder;case"==":return v.ChangeDetectionUtil.operation_equals;case"!=":return v.ChangeDetectionUtil.operation_not_equals;case"===":return v.ChangeDetectionUtil.operation_identical;case"!==":return v.ChangeDetectionUtil.operation_not_identical;case"<":return v.ChangeDetectionUtil.operation_less_then; + +case">":return v.ChangeDetectionUtil.operation_greater_then;case"<=":return v.ChangeDetectionUtil.operation_less_or_equals_then;case">=":return v.ChangeDetectionUtil.operation_greater_or_equals_then;case"&&":return v.ChangeDetectionUtil.operation_logical_and;case"||":return v.ChangeDetectionUtil.operation_logical_or;default:throw new h.BaseException("Unsupported operation "+e)}}function l(e){return f.isPresent(e)?""+e:""}function u(e){var t=e.length,r=t>0?e[0]:null,n=t>1?e[1]:null,i=t>2?e[2]:null,o=t>3?e[3]:null,a=t>4?e[4]:null,s=t>5?e[5]:null,c=t>6?e[6]:null,u=t>7?e[7]:null,p=t>8?e[8]:null,d=t>9?e[9]:null;switch(t-1){case 1:return function(e){return r+l(e)+n};case 2:return function(e,t){return r+l(e)+n+l(t)+i};case 3:return function(e,t,a){return r+l(e)+n+l(t)+i+l(a)+o};case 4:return function(e,t,s,c){return r+l(e)+n+l(t)+i+l(s)+o+l(c)+a};case 5:return function(e,t,c,u,p){return r+l(e)+n+l(t)+i+l(c)+o+l(u)+a+l(p)+s};case 6:return function(e,t,u,p,d,f){return r+l(e)+n+l(t)+i+l(u)+o+l(p)+a+l(d)+s+l(f)+c};case 7:return function(e,t,p,d,f,h,g){return r+l(e)+n+l(t)+i+l(p)+o+l(d)+a+l(f)+s+l(h)+c+l(g)+u};case 8:return function(e,t,d,f,h,g,m,v){return r+l(e)+n+l(t)+i+l(d)+o+l(f)+a+l(h)+s+l(g)+c+l(m)+u+l(v)+p};case 9:return function(e,t,f,h,g,m,v,y,_){return r+l(e)+n+l(t)+i+l(f)+o+l(h)+a+l(g)+s+l(m)+c+l(v)+u+l(y)+p+l(_)+d};default:throw new h.BaseException("Does not support more than 9 expressions")}}var p=System.global,d=p.define;p.define=void 0;var f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/change_detection/parser/ast"),v=e("angular2/src/core/change_detection/change_detection_util"),y=e("angular2/src/core/change_detection/dynamic_change_detector"),_=e("angular2/src/core/change_detection/directive_record"),b=e("angular2/src/core/change_detection/event_binding"),w=e("angular2/src/core/change_detection/coalesce"),C=e("angular2/src/core/change_detection/proto_record"),E=function(){function e(e){this._definition=e,this._propertyBindingRecords=n(e),this._eventBindingRecords=i(e),this._propertyBindingTargets=this._definition.bindingRecords.map(function(e){return e.target}),this._directiveIndices=this._definition.directiveRecords.map(function(e){return e.directiveIndex})}return e.prototype.instantiate=function(e){return new y.DynamicChangeDetector(this._definition.id,e,this._propertyBindingRecords.length,this._propertyBindingTargets,this._directiveIndices,this._definition.strategy,this._propertyBindingRecords,this._eventBindingRecords,this._definition.directiveRecords,this._definition.genConfig)},e}();t.DynamicProtoChangeDetector=E,t.createPropertyRecords=n,t.createEventRecords=i;var P=function(){function e(){this.records=[]}return e.prototype.add=function(e,t,r){var n=g.ListWrapper.last(this.records);f.isPresent(n)&&n.bindingRecord.directiveRecord==e.directiveRecord&&(n.lastInDirective=!1);var i=this.records.length;this._appendRecords(e,t,r);var o=g.ListWrapper.last(this.records);f.isPresent(o)&&o!==n&&(o.lastInBinding=!0,o.lastInDirective=!0,this._setArgumentToPureFunction(i))},e.prototype._setArgumentToPureFunction=function(e){for(var t=this,r=e;r0?r[0]:"mediumDate";return s.isNumber(t)&&(t=s.DateWrapper.fromMillis(t)),p.StringMapWrapper.contains(e._ALIASES,n)&&(n=p.StringMapWrapper.get(e._ALIASES,n)),c.DateFormatter.format(t,f,n)},e.prototype.supports=function(e){return s.isDate(e)||s.isNumber(e)},e._ALIASES={medium:"yMMMdjms","short":"yMdjm",fullDate:"yMMMMEEEEd",longDate:"yMMMMd",mediumDate:"yMMMd",shortDate:"yMd",mediumTime:"jms",shortTime:"jm"},e=o([s.CONST(),u.Pipe({name:"date"}),l.Injectable(),a("design:paramtypes",[])],e)}();return t.DatePipe=h,n.define=i,r.exports}),System.register("angular2/src/core/pipes/default_pipes",["angular2/src/core/pipes/async_pipe","angular2/src/core/pipes/uppercase_pipe","angular2/src/core/pipes/lowercase_pipe","angular2/src/core/pipes/json_pipe","angular2/src/core/pipes/slice_pipe","angular2/src/core/pipes/date_pipe","angular2/src/core/pipes/number_pipe","angular2/src/core/facade/lang","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/pipes/async_pipe"),a=e("angular2/src/core/pipes/uppercase_pipe"),s=e("angular2/src/core/pipes/lowercase_pipe"),c=e("angular2/src/core/pipes/json_pipe"),l=e("angular2/src/core/pipes/slice_pipe"),u=e("angular2/src/core/pipes/date_pipe"),p=e("angular2/src/core/pipes/number_pipe"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/di"),h=d.CONST_EXPR([o.AsyncPipe,a.UpperCasePipe,s.LowerCasePipe,c.JsonPipe,l.SlicePipe,p.DecimalPipe,p.PercentPipe,p.CurrencyPipe,u.DatePipe]);return t.DEFAULT_PIPES_TOKEN=d.CONST_EXPR(new f.OpaqueToken("Default Pipes")),t.DEFAULT_PIPES=d.CONST_EXPR(new f.Binding(t.DEFAULT_PIPES_TOKEN,{toValue:h})),n.define=i,r.exports}),System.register("angular2/src/core/forms/model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/forms/validators"],!0,function(e,t,r){function n(e){return e instanceof d}function i(e,t){return c.isBlank(t)?null:(t instanceof Array||(t=t.split("/")),t instanceof Array&&u.ListWrapper.isEmpty(t)?null:u.ListWrapper.reduce(t,function(e,t){if(e instanceof h)return c.isPresent(e.controls[t])?e.controls[t]:null;if(e instanceof g){var r=t;return c.isPresent(e.at(r))?e.at(r):null}return null},e))}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/async"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/forms/validators");t.VALID="VALID",t.INVALID="INVALID",t.isControl=n;var d=function(){function e(e){this.validator=e,this._pristine=!0,this._touched=!1}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this._status===t.VALID},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this._errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return this._pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return!this.pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return!this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueChanges",{get:function(){return this._valueChanges},enumerable:!0,configurable:!0}),e.prototype.markAsTouched=function(){this._touched=!0},e.prototype.markAsDirty=function(e){var t=(void 0===e?{}:e).onlySelf;t=c.normalizeBool(t),this._pristine=!1,c.isPresent(this._parent)&&!t&&this._parent.markAsDirty({onlySelf:t})},e.prototype.setParent=function(e){this._parent=e},e.prototype.updateValidity=function(e){var r=(void 0===e?{}:e).onlySelf;r=c.normalizeBool(r),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!r&&this._parent.updateValidity({onlySelf:r})},e.prototype.updateValueAndValidity=function(e){var r=void 0===e?{}:e,n=r.onlySelf,i=r.emitEvent;n=c.normalizeBool(n),i=c.isPresent(i)?i:!0,this._updateValue(),i&&l.ObservableWrapper.callNext(this._valueChanges,this._value),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!n&&this._parent.updateValueAndValidity({onlySelf:n,emitEvent:i})},e.prototype.find=function(e){return i(this,e)},e.prototype.getError=function(e,t){void 0===t&&(t=null);var r=c.isPresent(t)&&!u.ListWrapper.isEmpty(t)?this.find(t):this;return c.isPresent(r)&&c.isPresent(r._errors)?u.StringMapWrapper.get(r._errors,e):null},e.prototype.hasError=function(e,t){return void 0===t&&(t=null),c.isPresent(this.getError(e,t))},e.prototype._updateValue=function(){},e}();t.AbstractControl=d;var f=function(e){function t(t,r){void 0===t&&(t=null),void 0===r&&(r=p.Validators.nullValidator),e.call(this,r),this._value=t,this.updateValidity({onlySelf:!0}),this._valueChanges=new l.EventEmitter}return s(t,e),t.prototype.updateValue=function(e,t){var r=void 0===t?{}:t,n=r.onlySelf,i=r.emitEvent,o=r.emitModelToViewChange;o=c.isPresent(o)?o:!0,this._value=e,c.isPresent(this._onChange)&&o&&this._onChange(this._value),this.updateValueAndValidity({onlySelf:n,emitEvent:i})},t.prototype.registerOnChange=function(e){this._onChange=e},t}(d);t.Control=f;var h=function(e){function t(t,r,n){void 0===r&&(r=null),void 0===n&&(n=p.Validators.group),e.call(this,n),this.controls=t,this._optionals=c.isPresent(r)?r:{},this._valueChanges=new l.EventEmitter,this._setParentForControls(),this._value=this._reduceValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.addControl=function(e,t){this.controls[e]=t,t.setParent(this)},t.prototype.removeControl=function(e){u.StringMapWrapper["delete"](this.controls,e)},t.prototype.include=function(e){u.StringMapWrapper.set(this._optionals,e,!0),this.updateValueAndValidity()},t.prototype.exclude=function(e){u.StringMapWrapper.set(this._optionals,e,!1),this.updateValueAndValidity()},t.prototype.contains=function(e){var t=u.StringMapWrapper.contains(this.controls,e);return t&&this._included(e)},t.prototype._setParentForControls=function(){var e=this;u.StringMapWrapper.forEach(this.controls,function(t,r){t.setParent(e)})},t.prototype._updateValue=function(){this._value=this._reduceValue()},t.prototype._reduceValue=function(){return this._reduceChildren({},function(e,t,r){return e[r]=t.value,e})},t.prototype._reduceChildren=function(e,t){var r=this,n=e;return u.StringMapWrapper.forEach(this.controls,function(e,i){r._included(i)&&(n=t(n,e,i))}),n},t.prototype._included=function(e){var t=u.StringMapWrapper.contains(this._optionals,e);return!t||u.StringMapWrapper.get(this._optionals,e)},t}(d);t.ControlGroup=h;var g=function(e){function t(t,r){void 0===r&&(r=p.Validators.array),e.call(this,r),this.controls=t,this._valueChanges=new l.EventEmitter,this._setParentForControls(),this._updateValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.at=function(e){return this.controls[e]},t.prototype.push=function(e){this.controls.push(e),e.setParent(this),this.updateValueAndValidity()},t.prototype.insert=function(e,t){u.ListWrapper.insert(this.controls,e,t),t.setParent(this),this.updateValueAndValidity()},t.prototype.removeAt=function(e){u.ListWrapper.removeAt(this.controls,e),this.updateValueAndValidity()},Object.defineProperty(t.prototype,"length",{get:function(){return this.controls.length},enumerable:!0,configurable:!0}),t.prototype._updateValue=function(){this._value=this.controls.map(function(e){return e.value})},t.prototype._setParentForControls=function(){var e=this;this.controls.forEach(function(t){t.setParent(e)})},t}(d);return t.ControlArray=g,o.define=a,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_name",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/directives/shared","angular2/src/core/forms/validators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/ng_control"),g=e("angular2/src/core/forms/directives/shared"),m=e("angular2/src/core/forms/validators"),v=l.CONST_EXPR(new d.Binding(h.NgControl,{toAlias:d.forwardRef(function(){return y})})),y=function(e){function t(t,r){e.call(this),this.update=new u.EventEmitter,this._added=!1,this._parent=t,this.validators=r}return o(t,e),t.prototype.onChanges=function(e){this._added||(this.formDirective.addControl(this),this._added=!0),g.isPropertyUpdated(e,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))},t.prototype.onDestroy=function(){this.formDirective.removeControl(this)},t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},Object.defineProperty(t.prototype,"path",{get:function(){return g.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControl(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return m.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t=a([p.Directive({selector:"[ng-control]",bindings:[v],properties:["name: ngControl","model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Host()),c(0,d.SkipSelf()),c(1,d.Optional()),c(1,d.Inject(m.NG_VALIDATORS)),s("design:paramtypes",[f.ControlContainer,Array])],t)}(h.NgControl);return t.NgControlName=y,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/util",["angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e){return h.StringWrapper.replaceAllMapped(e,v,function(e){return"-"+e[1].toLowerCase()})}function i(e){return h.StringWrapper.replaceAllMapped(e,y,function(e){return e[1].toUpperCase()})}function o(e,r){var n,i,o=0;if(r){var a=g.DOM.firstChild(e),s=g.DOM.hasClass(a,t.NG_BINDING_CLASS);i=g.DOM.getElementsByClassName(a,t.NG_BINDING_CLASS),n=m.ListWrapper.createFixedSize(i.length+(s?1:0)),s&&(n[o++]=a)}else i=g.DOM.querySelectorAll(e,t.NG_BINDING_CLASS_SELECTOR),n=m.ListWrapper.createFixedSize(i.length);for(var c=0;c=1&&(n=g.DOM.nextSibling(n));for(var a=0;a0)for(var s=g.DOM.childNodes(e),c=0;c0)for(var p=g.DOM.childNodes(u),d=0;d0?r:null}function o(e,t){return g.isBlank(t)?e:"@media "+t+" {\n"+e+"\n}"}var a=System.global,s=a.define;a.define=void 0;var c=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},l=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},u=e("angular2/src/core/di"),p=e("angular2/src/core/render/xhr"),d=e("angular2/src/core/facade/collection"),f=e("angular2/src/core/services/url_resolver"),h=e("angular2/src/core/render/dom/compiler/style_url_resolver"),g=e("angular2/src/core/facade/lang"),m=e("angular2/src/core/facade/async"),v=function(){function e(e,t,r){this._xhr=e,this._styleUrlResolver=t,this._urlResolver=r}return e.prototype.inlineImports=function(e,t){return this._inlineImports(e,t,[])},e.prototype._inlineImports=function(e,t,r){var o=this,a=0,s=g.StringWrapper.split(e,y);if(1===s.length)return e;for(var c=[];a' element";throw l.isPresent(a)&&(h+=" and there are no matching directives with a corresponding property"),new u.BaseException(h)}s.push(f)}}),s}function i(e,t,r,n){return n.type===m.PropertyBindingType.PROPERTY?r?d.DOM.hasProperty(t,n.property):e.hasProperty(d.DOM.tagName(t),n.property):!0}function o(e,t,r){var n=r.split(".");if(1===n.length){var i=e.getMappedPropName(n[0]);return new m.ElementPropertyBinding(m.PropertyBindingType.PROPERTY,t,i)}if(n[0]==E)return new m.ElementPropertyBinding(m.PropertyBindingType.ATTRIBUTE,t,n[1]);if(n[0]==P)return new m.ElementPropertyBinding(m.PropertyBindingType.CLASS,t,v.camelCaseToDashCase(n[1]));if(n[0]==R){var o=n.length>2?n[2]:null;return new m.ElementPropertyBinding(m.PropertyBindingType.STYLE,t,n[1],o)}throw new u.BaseException("Invalid property name "+r)}var a=System.global,s=a.define;a.define=void 0;var c=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/dom/dom_adapter"),f=e("angular2/src/core/change_detection/change_detection"),h=e("angular2/src/core/render/dom/view/proto_view"),g=e("angular2/src/core/render/dom/view/element_binder"),m=e("angular2/src/core/render/api"),v=e("angular2/src/core/render/dom/util"),y=e("angular2/src/core/render/event_config"),_=function(){function e(e,t,r){this.rootElement=e,this.type=t,this.viewEncapsulation=r,this.variableBindings=new Map,this.elements=[],this.rootTextBindings=new Map,this.ngContentCount=0,this.hostAttributes=new Map}return e.prototype.bindElement=function(e,t){void 0===t&&(t=null);var r=new b(this.elements.length,e,t);return this.elements.push(r),d.DOM.addClass(e,v.NG_BINDING_CLASS),r},e.prototype.bindVariable=function(e,t){this.variableBindings.set(t,e)},e.prototype.bindRootText=function(e,t){this.rootTextBindings.set(e,t)},e.prototype.bindNgContent=function(){this.ngContentCount++},e.prototype.setHostAttribute=function(e,t){this.hostAttributes.set(e,t)},e.prototype.build=function(e,t){var r=[],i=[],o=[],a=[],s=this.ngContentCount;v.queryBoundTextNodeIndices(d.DOM.content(this.rootElement),this.rootTextBindings,function(e,t,r){o.push(r),a.push(t)}),p.ListWrapper.forEach(this.elements,function(a){var c=new p.Set,u=p.ListWrapper.map(a.directives,function(t){return a.eventBuilder.merge(t.eventBuilder),p.ListWrapper.forEach(t.templatePropertyNames,function(e){return c.add(e)}),new m.DirectiveBinder({directiveIndex:t.directiveIndex,propertyBindings:t.propertyBindings,eventBindings:t.eventBindings,hostPropertyBindings:n(e,a.element,!0,t.hostPropertyBindings,null)})}),d=l.isPresent(a.nestedProtoView)?a.nestedProtoView.build(e,t):null;l.isPresent(d)&&(s+=d.transitiveNgContentCount);var h=l.isPresent(a.parent)?a.parent.index:-1,y=[];v.queryBoundTextNodeIndices(a.element,a.textBindings,function(e,t,r){o.push(r),y.push(t)}),i.push(new m.RenderElementBinder({index:a.index,parentIndex:h,distanceToParent:a.distanceToParent,directives:u,nestedProtoView:d,propertyBindings:n(e,a.element,l.isPresent(a.componentId),a.propertyBindings,c),variableBindings:a.variableBindings,eventBindings:a.eventBindings,readAttributes:a.readAttributes})),r.push(new g.DomElementBinder({textNodeIndices:y,hasNestedProtoView:l.isPresent(d)||l.isPresent(a.componentId),hasNativeShadowRoot:!1,eventLocals:new f.LiteralArray(a.eventBuilder.buildEventLocals()),localEvents:a.eventBuilder.buildLocalEvents(),globalEvents:a.eventBuilder.buildGlobalEvents()}))});var c=d.DOM.childNodes(d.DOM.content(this.rootElement)).length;return new m.ProtoViewDto({render:new h.DomProtoViewRef(h.DomProtoView.create(t,this.type,this.rootElement,this.viewEncapsulation,[c],a,r,this.hostAttributes)),type:this.type,elementBinders:i,variableBindings:this.variableBindings,textBindings:o,transitiveNgContentCount:s})},e}();t.ProtoViewBuilder=_;var b=function(){function e(e,t,r){this.index=e,this.element=t,this.parent=null,this.distanceToParent=0,this.directives=[],this.nestedProtoView=null,this.propertyBindings=new Map,this.variableBindings=new Map,this.eventBindings=[],this.eventBuilder=new C,this.textBindings=new Map,this.readAttributes=new Map,this.componentId=null}return e.prototype.setParent=function(e,t){return this.parent=e,l.isPresent(e)&&(this.distanceToParent=t),this},e.prototype.readAttribute=function(e){l.isBlank(this.readAttributes.get(e))&&this.readAttributes.set(e,d.DOM.getAttribute(this.element,e))},e.prototype.bindDirective=function(e){var t=new w(e);return this.directives.push(t),t},e.prototype.bindNestedProtoView=function(e){if(l.isPresent(this.nestedProtoView))throw new u.BaseException("Only one nested view per element is allowed");return this.nestedProtoView=new _(e,m.ViewType.EMBEDDED,m.ViewEncapsulation.None),this.nestedProtoView},e.prototype.bindProperty=function(e,t){this.propertyBindings.set(e,t)},e.prototype.bindVariable=function(e,t){l.isPresent(this.nestedProtoView)?this.nestedProtoView.bindVariable(e,t):this.variableBindings.set(t,e)},e.prototype.bindEvent=function(e,t,r){void 0===r&&(r=null),this.eventBindings.push(this.eventBuilder.add(e,t,r))},e.prototype.bindText=function(e,t){this.textBindings.set(e,t)},e.prototype.setComponentId=function(e){this.componentId=e},e}();t.ElementBinderBuilder=b;var w=function(){function e(e){this.directiveIndex=e,this.propertyBindings=new Map,this.templatePropertyNames=[],this.hostPropertyBindings=new Map,this.eventBindings=[],this.eventBuilder=new C}return e.prototype.bindProperty=function(e,t,r){this.propertyBindings.set(e,t),l.isPresent(r)&&this.templatePropertyNames.push(r)},e.prototype.bindHostProperty=function(e,t){this.hostPropertyBindings.set(e,t)},e.prototype.bindEvent=function(e,t,r){void 0===r&&(r=null),this.eventBindings.push(this.eventBuilder.add(e,t,r))},e}();t.DirectiveBuilder=w;var C=function(e){function t(){e.call(this),this.locals=[],this.localEvents=[],this.globalEvents=[],this._implicitReceiver=new f.ImplicitReceiver}return c(t,e),t.prototype.add=function(e,t,r){var n=t.ast,i=l.isPresent(r)?r+y.EVENT_TARGET_SEPARATOR+e:e,o=new m.EventBinding(i,new f.ASTWithSource(n,t.source,t.location)),a=new g.Event(e,r,i);return l.isBlank(r)?this.localEvents.push(a):this.globalEvents.push(a),o},t.prototype.visitPropertyRead=function(e){for(var t=!1,r=e;!t&&r instanceof f.PropertyRead;){var n=r;"$event"==n.name&&(t=!0),r=n.receiver}if(t){this.locals.push(e);var i=this.locals.length-1;return new f.PropertyRead(this._implicitReceiver,""+i,function(e){return e[i]})}return e},t.prototype.buildEventLocals=function(){return this.locals},t.prototype.buildLocalEvents=function(){return this.localEvents},t.prototype.buildGlobalEvents=function(){return this.globalEvents},t.prototype.merge=function(e){this._merge(this.localEvents,e.localEvents),this._merge(this.globalEvents,e.globalEvents),this.locals.concat(e.locals)},t.prototype._merge=function(e,t){for(var r=[],n=0;n-1?(n=o.StringWrapper.substring(e,0,c).trim(),a=this._splitBindConfig(o.StringWrapper.substring(e,c+1)),i=s.ListWrapper.removeAt(a,0)):(n=e,i=e,a=[]),i=p.dashCaseToCamelCase(i);var l=t.bindElement().propertyBindings.get(i);if(o.isBlank(l)){var u=t.attrs().get(p.camelCaseToDashCase(i));o.isPresent(u)&&(l=this._parser.wrapLiteralPrimitive(u,t.elementDescription))}o.isPresent(l)&&r.bindProperty(n,l,i)},e.prototype._bindDirectiveEvent=function(e,t,r,n){var i=this._parser.parseAction(t,r.elementDescription),o=d.EventConfig.parse(e),a=o.isLongForm?o.fieldName:null;n.bindEvent(o.eventName,i,a)},e.prototype._bindHostProperty=function(e,t,r,n){var i=this._parser.parseSimpleBinding(t,"hostProperties of "+r.elementDescription);n.bindHostProperty(e,i)},e.prototype._addHostAttribute=function(e,t,r){o.StringWrapper.equals(e,"class")?s.ListWrapper.forEach(t.split(" "),function(e){c.DOM.addClass(r.element,e)}):c.DOM.hasAttribute(r.element,e)||c.DOM.setAttribute(r.element,e,t)},e.prototype._splitBindConfig=function(e){return s.ListWrapper.map(e.split("|"),function(e){return e.trim()})},e}();return t.DirectiveParser=f,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/style_encapsulator",["angular2/src/core/render/api","angular2/src/core/render/dom/util","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/render/dom/compiler/shadow_css"],!0,function(e,t,r){function n(e){return"_nghost-"+e}function i(e){return"_ngcontent-"+e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/render/api"),c=e("angular2/src/core/render/dom/util"),l=e("angular2/src/core/dom/dom_adapter"),u=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/render/dom/compiler/shadow_css"),d=function(){function e(e,t,r){this._appId=e,this._view=t,this._componentUIDsCache=r}return e.prototype.processElement=function(e,t,r){c.isElementWithTag(t.element,c.NG_CONTENT_ELEMENT_NAME)?t.inheritedProtoView.bindNgContent():this._view.encapsulation===s.ViewEncapsulation.Emulated&&this._processEmulatedScopedElement(t,e)},e.prototype.processStyle=function(e){var t=this._view.encapsulation;return t===s.ViewEncapsulation.Emulated?this._shimCssForComponent(e,this._view.componentId):e},e.prototype._processEmulatedScopedElement=function(e,t){var r=e.element,o=this._view.componentId,a=e.inheritedProtoView.type;if(a!==s.ViewType.HOST&&u.isPresent(o)){var c=i(this._getComponentId(o));if(l.DOM.setAttribute(r,c,""),u.isBlank(t)&&a==s.ViewType.COMPONENT){var p=n(this._getComponentId(o));e.inheritedProtoView.setHostAttribute(p,"")}}},e.prototype._shimCssForComponent=function(e,t){var r=this._getComponentId(t),o=new p.ShadowCss;return o.shimCssText(e,i(r),n(r))},e.prototype._getComponentId=function(e){var t=this._componentUIDsCache.get(e);return u.isBlank(t)&&(t=this._appId+"-"+this._componentUIDsCache.size,this._componentUIDsCache.set(e,t)),t},e}();return t.StyleEncapsulator=d,o.define=a,r.exports}),System.register("angular2/src/animate/animation",["angular2/src/core/facade/lang","angular2/src/core/facade/math","angular2/src/core/render/dom/util","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/math"),s=e("angular2/src/core/render/dom/util"),c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/dom/dom_adapter"),u=function(){function e(e,t,r){var n=this;this.element=e,this.data=t,this.browserDetails=r,this.callbacks=[],this.eventClearFunctions=[],this.completed=!1,this._stringPrefix="",this.startTime=o.DateWrapper.toMillis(o.DateWrapper.now()),this._stringPrefix=l.DOM.getAnimationPrefix(),this.setup(),this.wait(function(e){return n.start()})}return Object.defineProperty(e.prototype,"totalTime",{get:function(){var e=null!=this.computedDelay?this.computedDelay:0,t=null!=this.computedDuration?this.computedDuration:0;return e+t},enumerable:!0,configurable:!0}),e.prototype.wait=function(e){this.browserDetails.raf(e,2)},e.prototype.setup=function(){null!=this.data.fromStyles&&this.applyStyles(this.data.fromStyles),null!=this.data.duration&&this.applyStyles({transitionDuration:this.data.duration.toString()+"ms"}),null!=this.data.delay&&this.applyStyles({transitionDelay:this.data.delay.toString()+"ms"})},e.prototype.start=function(){this.addClasses(this.data.classesToAdd),this.addClasses(this.data.animationClasses),this.removeClasses(this.data.classesToRemove),null!=this.data.toStyles&&this.applyStyles(this.data.toStyles);var e=l.DOM.getComputedStyle(this.element);this.computedDelay=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-delay")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-delay"))),this.computedDuration=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-duration")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-duration"))),this.addEvents()},e.prototype.applyStyles=function(e){var t=this;c.StringMapWrapper.forEach(e,function(e,r){var n=s.camelCaseToDashCase(r);o.isPresent(l.DOM.getStyle(t.element,n))?l.DOM.setStyle(t.element,n,e.toString()):l.DOM.setStyle(t.element,t._stringPrefix+n,e.toString())})},e.prototype.addClasses=function(e){for(var t=0,r=e.length;r>t;t++)l.DOM.addClass(this.element,e[t])},e.prototype.removeClasses=function(e){for(var t=0,r=e.length;r>t;t++)l.DOM.removeClass(this.element,e[t])},e.prototype.addEvents=function(){var e=this;this.totalTime>0?this.eventClearFunctions.push(l.DOM.onAndCancel(this.element,l.DOM.getTransitionEnd(),function(t){return e.handleAnimationEvent(t)})):this.handleAnimationCompleted()},e.prototype.handleAnimationEvent=function(e){var t=a.Math.round(1e3*e.elapsedTime);this.browserDetails.elapsedTimeIncludesDelay||(t+=this.computedDelay),e.stopPropagation(),t>=this.totalTime&&this.handleAnimationCompleted()},e.prototype.handleAnimationCompleted=function(){this.removeClasses(this.data.animationClasses),this.callbacks.forEach(function(e){return e()}),this.callbacks=[],this.eventClearFunctions.forEach(function(e){return e()}),this.eventClearFunctions=[],this.completed=!0},e.prototype.onComplete=function(e){return this.completed?e():this.callbacks.push(e),this},e.prototype.parseDurationString=function(e){var t=0;if(null==e||e.length<2)return t;if("ms"==e.substring(e.length-2)){var r=o.NumberWrapper.parseInt(this.stripLetters(e),10);r>t&&(t=r)}else if("s"==e.substring(e.length-1)){var n=1e3*o.NumberWrapper.parseFloat(this.stripLetters(e)),r=a.Math.floor(n);r>t&&(t=r)}return t},e.prototype.stripLetters=function(e){return o.StringWrapper.replaceAll(e,o.RegExpWrapper.create("[^0-9]+$",""),"")},e}();return t.Animation=u,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/event_manager",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/zone/ng_zone","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/dom/dom_adapter"),f=e("angular2/src/core/zone/ng_zone"),h=e("angular2/src/core/di");t.EVENT_MANAGER_PLUGINS=l.CONST_EXPR(new h.OpaqueToken("EventManagerPlugins"));var g=function(){function e(e,t){var r=this;this._zone=t,e.forEach(function(e){return e.manager=r}),this._plugins=p.ListWrapper.reversed(e)}return e.prototype.addEventListener=function(e,t,r){var n=this._findPluginFor(t);n.addEventListener(e,t,r)},e.prototype.addGlobalEventListener=function(e,t,r){var n=this._findPluginFor(t);return n.addGlobalEventListener(e,t,r)},e.prototype.getZone=function(){return this._zone},e.prototype._findPluginFor=function(e){for(var t=this._plugins,r=0;r #text("+n+"):nth-child("+t+")")}function i(e,t,r,n){return new h.HtmlAttrAst(r,n,t+"["+r+"="+n+"]")}function o(e,t,r){var n=f.DOM.nodeName(e).toLowerCase(),i=r+" > "+n+":nth-child("+t+")",o=a(e,i),c=s(e,i);return new h.HtmlElementAst(n,o,c,i)}function a(e,t){var r=f.DOM.attributeMap(e),n=[];return r.forEach(function(e,t){return n.push([t,e])}),n.sort(function(e,t){return d.StringWrapper.compare(e[0],t[0])}),n.map(function(r){return i(e,t,r[0],r[1])})}function s(e,t){var r=f.DOM.templateAwareRoot(e),i=f.DOM.childNodesAsList(r),a=[],s=0;return i.forEach(function(e){var r=null;if(f.DOM.isTextNode(e)){var i=e;r=n(i,s,t)}else if(f.DOM.isElementNode(e)){var c=e;r=o(c,s,t)}d.isPresent(r)&&a.push(r),s++}),a}var c=System.global,l=c.define;c.define=void 0;var u=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/dom/dom_adapter"),h=e("angular2/src/compiler/html_ast"),g=e("angular2/src/compiler/util"),m=e("angular2/src/core/di"),v=function(){function e(){}return e.prototype.parse=function(e,t){var r=f.DOM.createTemplate(e);return s(r,t)},e.prototype.unparse=function(e){var t=new y,r=[];return h.htmlVisitAll(t,e,r),r.join("")},e=u([m.Injectable(),p("design:paramtypes",[])],e)}();t.HtmlParser=v;var y=function(){function e(){}return e.prototype.visitElement=function(e,t){t.push("<"+e.name);var r=[];return h.htmlVisitAll(this,e.attrs,r),e.attrs.length>0&&(t.push(" "),t.push(r.join(" "))),t.push(">"),h.htmlVisitAll(this,e.children,t),t.push(""),null},e.prototype.visitAttr=function(e,t){return t.push(e.name+"="+g.escapeDoubleQuoteString(e.value)),null},e.prototype.visitText=function(e,t){return t.push(e.value),null},e}();return c.define=l,r.exports}),System.register("angular2/src/core/directives",["angular2/src/core/facade/lang","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_non_bindable","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_non_bindable","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/observable_list_diff"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/directives/ng_class"),c=e("angular2/src/core/directives/ng_for"),l=e("angular2/src/core/directives/ng_if"),u=e("angular2/src/core/directives/ng_non_bindable"),p=e("angular2/src/core/directives/ng_style"),d=e("angular2/src/core/directives/ng_switch"),f=e("angular2/src/core/directives/ng_class");t.NgClass=f.NgClass;var h=e("angular2/src/core/directives/ng_for");t.NgFor=h.NgFor;var g=e("angular2/src/core/directives/ng_if");t.NgIf=g.NgIf;var m=e("angular2/src/core/directives/ng_non_bindable");t.NgNonBindable=m.NgNonBindable;var v=e("angular2/src/core/directives/ng_style");t.NgStyle=v.NgStyle;var y=e("angular2/src/core/directives/ng_switch");return t.NgSwitch=y.NgSwitch,t.NgSwitchWhen=y.NgSwitchWhen,t.NgSwitchDefault=y.NgSwitchDefault,n(e("angular2/src/core/directives/observable_list_diff")),t.CORE_DIRECTIVES=a.CONST_EXPR([s.NgClass,c.NgFor,l.NgIf,u.NgNonBindable,p.NgStyle,d.NgSwitch,d.NgSwitchWhen,d.NgSwitchDefault]),i.define=o,r.exports}),System.register("angular2/src/core/debug",["angular2/src/core/debug/debug_element","angular2/src/core/debug/debug_element_view_listener"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0,n(e("angular2/src/core/debug/debug_element"));var a=e("angular2/src/core/debug/debug_element_view_listener");return t.inspectNativeElement=a.inspectNativeElement,t.ELEMENT_PROBE_BINDINGS=a.ELEMENT_PROBE_BINDINGS,i.define=o,r.exports}),System.register("angular2/src/core/di/binding",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection","angular2/src/core/di/key","angular2/src/core/di/metadata","angular2/src/core/di/exceptions","angular2/src/core/di/forward_ref"],!0,function(e,t,r){function n(e){return new A(e)}function i(e){var t,r;if(y.isPresent(e.toClass)){var n=R.resolveForwardRef(e.toClass);t=w.reflector.factory(n),r=p(n)}else y.isPresent(e.toAlias)?(t=function(e){return e},r=[x.fromKey(C.Key.get(e.toAlias))]):y.isPresent(e.toFactory)?(t=e.toFactory,r=u(e.toFactory,e.dependencies)):(t=function(){return e.toValue},r=S);return new O(t,r)}function o(e){return new I(C.Key.get(e.token),[i(e)],!1)}function a(e){var t=s(c(e,new Map));return t.map(function(e){if(e instanceof T)return new I(e.key,[e.resolvedFactory],!1);var t=e;return new I(t[0].key,t.map(function(e){return e.resolvedFactory}),!0)})}function s(e){return b.MapWrapper.values(e)}function c(e,t){return b.ListWrapper.forEach(e,function(e){if(e instanceof y.Type)l(n(e).toClass(e),t);else if(e instanceof D)l(e,t);else{if(!(e instanceof Array))throw new P.InvalidBindingError(e instanceof A?e.token:e);c(e,t)}}),t}function l(e,t){var r=C.Key.get(e.token),n=i(e),o=new T(r,n);if(e.multi){var a=t.get(r.id);if(a instanceof Array)a.push(o);else{if(!y.isBlank(a))throw new P.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,[o])}}else{var a=t.get(r.id);if(a instanceof Array)throw new P.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,o)}}function u(e,t){if(y.isBlank(t))return p(e);var r=b.ListWrapper.map(t,function(e){return[e]});return b.ListWrapper.map(t,function(t){return d(e,t,r)})}function p(e){var t=w.reflector.parameters(e);if(y.isBlank(t))return[];if(b.ListWrapper.any(t,function(e){return y.isBlank(e)}))throw new P.NoAnnotationError(e,t);return b.ListWrapper.map(t,function(r){return d(e,r,t)})}function d(e,t,r){var n=[],i=null,o=!1;if(!y.isArray(t))return f(t,o,null,null,n);for(var a=null,s=null,c=0;c=0;r--)d.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterContentChecked()},e.prototype.notifyAfterViewChecked=function(){for(var e=this.proto.elementBinders.length,t=this.elementInjectors,r=e-1;r>=0;r--)d.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterViewChecked()},e.prototype.getDirectiveFor=function(e){var t=this.elementInjectors[this.elementOffset+e.elementIndex];return t.getDirectiveAtIndex(e.directiveIndex)},e.prototype.getNestedView=function(e){var t=this.mainMergeMapping.nestedViewIndicesByElementIndex[e];return d.isPresent(t)?this.views[t]:null},e.prototype.getHostElement=function(){var e=this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset];return d.isPresent(e)?this.elementRefs[e]:null},e.prototype.getDebugContext=function(e,t){try{var r=this.elementOffset+e,n=rP;P++){var R=e.mergeMapping.hostElementIndicesByViewIndex[P],x=u.isPresent(R)?d.internalView(g[R].parentView):null,S=u.isPresent(R)?x.proto.elementBinders[R-x.elementOffset].nestedProtoView:e,D=null;(0===P||S.type===m.ViewType.EMBEDDED)&&(D=i[E++]);var I=new p.AppView(n,S,e.mergeMapping,P,w,C,S.protoLocals,o,D);b[P]=I;for(var O=[],A=0;A=0;l--)u.isPresent(s.parent)&&o.rootElementInjectors[l].link(s.parent);s.traverseAndSetQueriesAsDirty()},e.prototype.detachViewInContainer=function(e,t,r){var n=e.viewContainers[t],i=n.views[r];e.elementInjectors[t].traverseAndSetQueriesAsDirty(),i.changeDetector.remove(),c.ListWrapper.removeAt(n.views,r);for(var o=0;o=o;){var s=e.views[o],c=s.proto;if(s!==e&&s.proto.type===m.ViewType.EMBEDDED)o+=e.mainMergeMapping.nestedViewCountByViewIndex[o]+1;else{if(s!==e){t=null,i=null;var l=e.mainMergeMapping.hostElementIndicesByViewIndex[o];r=e.elementInjectors[l],n=r.getComponent()}s.context=n,s.locals.parent=i;for(var p=c.elementBinders,d=0;d=r;r++){var n=e.views[r];if(n.hydrated()){u.isPresent(n.locals)&&n.locals.clearValues(),n.context=null,n.changeDetector.dehydrate();for(var i=n.proto.elementBinders,o=0;o=0){var n=t.substring(0,t.lastIndexOf("/"));i._substituteBaseUrl(d.DOM.content(r),n)}for(var o=d.DOM.querySelectorAll(d.DOM.content(r),"STYLE"),a=[],s=0;s=0&&d.DOM.setAttribute(e,n,c.StringWrapper.replaceAll(r,/\$baseUrl/g,t))})}for(var n=d.DOM.childNodes(e),i=0;i new "+n+"(dispatcher)"),r.toString()}return r=new c.ChangeDetectorJITGenerator(t,""+v+g,""+m+h),i.push("function(dispatcher) { return new "+r.typeName+"(dispatcher); }"),r.generateSource()});return new s.SourceExpressions(o,i)},e=o([f.Injectable(),a("design:paramtypes",[u.ChangeDetectorGenConfig])],e)}();return t.ChangeDetectionCompiler=_,n.define=i,r.exports}),System.register("angular2/src/compiler/template_parser",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/change_detection","angular2/src/compiler/html_parser","angular2/src/compiler/template_ast","angular2/src/core/render/dom/compiler/selector","angular2/src/core/render/dom/schema/element_schema_registry","angular2/src/compiler/template_preparser","angular2/src/compiler/html_ast","angular2/src/compiler/util"],!0,function(e,t,r){function n(e){return u.StringWrapper.split(e.trim(),/\s+/g)}function i(e,t){var r=new m.CssSelector;r.setElement(e);for(var i=0;i0){var o=n.errors.join("\n");throw new d.BaseException("Template parse errors:\n"+o)}return i},e=s([p.Injectable(),c("design:paramtypes",[f.Parser,v.ElementSchemaRegistry,h.HtmlParser])],e)}();t.TemplateParser=A;var T=function(){function e(e,t,r){var n=this;this._exprParser=t,this._schemaRegistry=r,this.errors=[],this.directivesIndexByTypeId=new Map,this.selectorMatcher=new m.SelectorMatcher,l.ListWrapper.forEachWithIndex(e,function(e,t){var r=m.CssSelector.parse(e.selector);n.selectorMatcher.addSelectables(r,e),n.directivesIndexByTypeId.set(e.type.id,t)})}return e.prototype._reportError=function(e){this.errors.push(e)},e.prototype._parseInterpolation=function(e,t){try{return this._exprParser.parseInterpolation(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseAction=function(e,t){try{return this._exprParser.parseAction(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseBinding=function(e,t){try{return this._exprParser.parseBinding(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseTemplateBindings=function(e,t){try{return this._exprParser.parseTemplateBindings(e,t)}catch(r){return this._reportError(""+r),[]}},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O),n=this._parseInterpolation(e.value,e.sourceInfo);return u.isPresent(n)?new g.BoundTextAst(n,r,e.sourceInfo):new g.TextAst(e.value,r,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitElement=function(e,t){var r=this,n=e.name,o=y.preparseElement(e);if(o.type===y.PreparsedElementType.SCRIPT||o.type===y.PreparsedElementType.STYLE||o.type===y.PreparsedElementType.STYLESHEET)return null;var a=[],s=[],c=[],u=[],p=[],d=[],f=[],h=!1,m=[];e.attrs.forEach(function(e){a.push([e.name,e.value]);var t=r._parseAttr(e,a,s,u,c),n=r._parseInlineTemplateBinding(e,f,p,d);t||n||m.push(r.visitAttr(e,null)),n&&(h=!0)});var v,b=n==C,w=i(n,a),E=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,w),s,b?[]:c,e.sourceInfo),P=this._createElementPropertyAsts(e.name,s,E),R=_.htmlVisitAll(o.nonBindable?V:this,e.children,k.create(E)),x=h?null:t.findNgContentIndex(w);if(o.type===y.PreparsedElementType.NG_CONTENT)v=new g.NgContentAst(x,e.sourceInfo);else if(b)this._assertNoComponentsNorElementBindingsOnTemplate(E,P,u,e.sourceInfo),v=new g.EmbeddedTemplateAst(m,c,E,R,x,e.sourceInfo);else{this._assertOnlyOneComponent(E,e.sourceInfo);var S=l.ListWrapper.filter(c,function(e){return 0===e.value.length});v=new g.ElementAst(n,m,P,u,S,E,R,x,e.sourceInfo)}if(h){var D=i(C,f),I=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,D),p,[],e.sourceInfo),O=this._createElementPropertyAsts(e.name,p,I);this._assertNoComponentsNorElementBindingsOnTemplate(I,O,[],e.sourceInfo),v=new g.EmbeddedTemplateAst([],d,I,[v],t.findNgContentIndex(D),e.sourceInfo)}return v},e.prototype._parseInlineTemplateBinding=function(e,t,r,n){var i=null;if(e.name==E)i=e.value;else if(u.StringWrapper.startsWith(e.name,P)){var o=u.StringWrapper.substring(e.name,P.length);i=0==e.value.length?o:o+" "+e.value}if(u.isPresent(i)){for(var a=this._parseTemplateBindings(i,e.sourceInfo),s=0;s0&&!l.SetWrapper.has(a,e.name)&&o._reportError('There is no directive with "exportAs" set to "'+e.value+'" at '+e.sourceInfo)}),s},e.prototype._createDirectiveHostPropertyAsts=function(e,t,r,n){var i=this;u.isPresent(t)&&l.StringMapWrapper.forEach(t,function(t,o){var a=i._parseBinding(t,r);n.push(i._createElementPropertyAst(e,o,a,r))})},e.prototype._createDirectiveHostEventAsts=function(e,t,r){var n=this;u.isPresent(e)&&l.StringMapWrapper.forEach(e,function(e,i){n._parseEvent(i,e,t,[],r)})},e.prototype._createDirectivePropertyAsts=function(e,t,r){if(u.isPresent(e)){var n=new Map;t.forEach(function(e){var t=b.dashCaseToCamelCase(e.name),r=n.get(e.name);(u.isBlank(r)||r.isLiteral)&&n.set(t,e)}),l.StringMapWrapper.forEach(e,function(e,t){e=b.dashCaseToCamelCase(e);var i=n.get(e);u.isPresent(i)&&r.push(new g.BoundDirectivePropertyAst(t,i.name,i.expression,i.sourceInfo))})}},e.prototype._createElementPropertyAsts=function(e,t,r){var n=this,i=[],o=new Map;return r.forEach(function(e){e.properties.forEach(function(e){o.set(e.templateName,e)})}),t.forEach(function(t){!t.isLiteral&&u.isBlank(o.get(t.name))&&i.push(n._createElementPropertyAst(e,t.name,t.expression,t.sourceInfo))}),i},e.prototype._createElementPropertyAst=function(e,t,r,n){var i,o,a=null,s=u.StringWrapper.split(t,x);return 1===s.length?(o=this._schemaRegistry.getMappedPropName(b.dashCaseToCamelCase(s[0])),i=g.PropertyBindingType.Property,this._schemaRegistry.hasProperty(e,o)||this._reportError("Can't bind to '"+o+"' since it isn't a known native property in "+n)):s[0]==S?(o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Attribute):s[0]==D?(o=s[1],i=g.PropertyBindingType.Class):s[0]==I?(a=s.length>2?s[2]:null,o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Style):(this._reportError("Invalid property name "+t+" in "+n),i=null),new g.BoundElementPropertyAst(o,i,r,a,n)},e.prototype._findComponentDirectiveNames=function(e){var t=[];return e.forEach(function(e){var r=e.directive.type.name;e.directive.isComponent&&t.push(r)}),t},e.prototype._assertOnlyOneComponent=function(e,t){var r=this._findComponentDirectiveNames(e);r.length>1&&this._reportError("More than one component: "+r.join(",")+" in "+t)},e.prototype._assertNoComponentsNorElementBindingsOnTemplate=function(e,t,r,n){var i=this,o=this._findComponentDirectiveNames(e);o.length>0&&this._reportError("Components on an embedded template: "+o.join(",")+" in "+n),t.forEach(function(e){i._reportError("Property binding "+e.name+" not used by any directive on an embedded template in "+e.sourceInfo)}),r.forEach(function(e){i._reportError("Event binding "+e.name+" on an embedded template in "+e.sourceInfo)})},e}(),M=function(){function e(){}return e.prototype.visitElement=function(e,t){var r=y.preparseElement(e);if(r.type===y.PreparsedElementType.SCRIPT||r.type===y.PreparsedElementType.STYLE||r.type===y.PreparsedElementType.STYLESHEET)return null;var n=e.attrs.map(function(e){return[e.name,e.value]}),o=i(e.name,n),a=t.findNgContentIndex(o),s=_.htmlVisitAll(this,e.children,B);return new g.ElementAst(e.name,_.htmlVisitAll(this,e.attrs),[],[],[],[],s,a,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O);return new g.TextAst(e.value,r,e.sourceInfo)},e}(),N=function(){function e(e,t,r,n){this.name=e,this.expression=t,this.isLiteral=r,this.sourceInfo=n}return e}();!function(){function e(e,t){this.message=e,this.sourceInfo=t}return e}(),t.splitClasses=n;var k=function(){function e(e,t){this.ngContentIndexMatcher=e,this.wildcardNgContentIndex=t}return e.create=function(t){if(0===t.length||!t[0].directive.isComponent)return B;for(var r=new m.SelectorMatcher,n=t[0].directive.template.ngContentSelectors,i=null,o=0;o0?t[0]:null},e}(),B=new k(new m.SelectorMatcher,null),V=new M;return o.define=a,r.exports}),System.register("angular2/src/core/di/injector",["angular2/src/core/facade/collection","angular2/src/core/di/binding","angular2/src/core/di/exceptions","angular2/src/core/facade/lang","angular2/src/core/di/key","angular2/src/core/di/metadata"],!0,function(e,t,r){function n(e,t){return e===t||t===h.PublicAndPrivate||e===h.PublicAndPrivate}function i(e,t){for(var r=[],n=0;n0&&(this.binding0=t[0].binding,this.keyId0=t[0].getKeyId(),this.visibility0=t[0].visibility),r>1&&(this.binding1=t[1].binding,this.keyId1=t[1].getKeyId(),this.visibility1=t[1].visibility),r>2&&(this.binding2=t[2].binding,this.keyId2=t[2].getKeyId(),this.visibility2=t[2].visibility),r>3&&(this.binding3=t[3].binding,this.keyId3=t[3].getKeyId(),this.visibility3=t[3].visibility),r>4&&(this.binding4=t[4].binding,this.keyId4=t[4].getKeyId(),this.visibility4=t[4].visibility),r>5&&(this.binding5=t[5].binding,this.keyId5=t[5].getKeyId(),this.visibility5=t[5].visibility),r>6&&(this.binding6=t[6].binding,this.keyId6=t[6].getKeyId(),this.visibility6=t[6].visibility),r>7&&(this.binding7=t[7].binding,this.keyId7=t[7].getKeyId(),this.visibility7=t[7].visibility),r>8&&(this.binding8=t[8].binding,this.keyId8=t[8].getKeyId(),this.visibility8=t[8].visibility),r>9&&(this.binding9=t[9].binding,this.keyId9=t[9].getKeyId(),this.visibility9=t[9].visibility)}return e.prototype.getBindingAtIndex=function(e){if(0==e)return this.binding0;if(1==e)return this.binding1;if(2==e)return this.binding2;if(3==e)return this.binding3;if(4==e)return this.binding4;if(5==e)return this.binding5;if(6==e)return this.binding6;if(7==e)return this.binding7;if(8==e)return this.binding8;if(9==e)return this.binding9;throw new l.OutOfBoundsError(e)},e.prototype.createInjectorStrategy=function(e){return new y(e,this)},e}();t.ProtoInjectorInlineStrategy=g;var m=function(){function e(e,t){var r=t.length;this.bindings=s.ListWrapper.createFixedSize(r),this.keyIds=s.ListWrapper.createFixedSize(r),this.visibilities=s.ListWrapper.createFixedSize(r);for(var n=0;r>n;n++)this.bindings[n]=t[n].binding,this.keyIds[n]=t[n].getKeyId(),this.visibilities[n]=t[n].visibility}return e.prototype.getBindingAtIndex=function(e){if(0>e||e>=this.bindings.length)throw new l.OutOfBoundsError(e);return this.bindings[e]},e.prototype.createInjectorStrategy=function(e){return new _(this,e)},e}();t.ProtoInjectorDynamicStrategy=m;var v=function(){function e(e){this.numberOfBindings=e.length,this._strategy=e.length>f?new m(this,e):new g(this,e)}return e.prototype.getBindingAtIndex=function(e){return this._strategy.getBindingAtIndex(e)},e}();t.ProtoInjector=v;var y=function(){function e(e,r){this.injector=e,this.protoStrategy=r,this.obj0=t.UNDEFINED,this.obj1=t.UNDEFINED,this.obj2=t.UNDEFINED,this.obj3=t.UNDEFINED,this.obj4=t.UNDEFINED,this.obj5=t.UNDEFINED,this.obj6=t.UNDEFINED,this.obj7=t.UNDEFINED,this.obj8=t.UNDEFINED,this.obj9=t.UNDEFINED}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){var i=this.protoStrategy,o=this.injector;return i.keyId0===e&&n(i.visibility0,r)?(this.obj0===t.UNDEFINED&&(this.obj0=o._new(i.binding0,i.visibility0)),this.obj0):i.keyId1===e&&n(i.visibility1,r)?(this.obj1===t.UNDEFINED&&(this.obj1=o._new(i.binding1,i.visibility1)),this.obj1):i.keyId2===e&&n(i.visibility2,r)?(this.obj2===t.UNDEFINED&&(this.obj2=o._new(i.binding2,i.visibility2)),this.obj2):i.keyId3===e&&n(i.visibility3,r)?(this.obj3===t.UNDEFINED&&(this.obj3=o._new(i.binding3,i.visibility3)),this.obj3):i.keyId4===e&&n(i.visibility4,r)?(this.obj4===t.UNDEFINED&&(this.obj4=o._new(i.binding4,i.visibility4)),this.obj4):i.keyId5===e&&n(i.visibility5,r)?(this.obj5===t.UNDEFINED&&(this.obj5=o._new(i.binding5,i.visibility5)),this.obj5):i.keyId6===e&&n(i.visibility6,r)?(this.obj6===t.UNDEFINED&&(this.obj6=o._new(i.binding6,i.visibility6)),this.obj6):i.keyId7===e&&n(i.visibility7,r)?(this.obj7===t.UNDEFINED&&(this.obj7=o._new(i.binding7,i.visibility7)),this.obj7):i.keyId8===e&&n(i.visibility8,r)?(this.obj8===t.UNDEFINED&&(this.obj8=o._new(i.binding8,i.visibility8)),this.obj8):i.keyId9===e&&n(i.visibility9,r)?(this.obj9===t.UNDEFINED&&(this.obj9=o._new(i.binding9,i.visibility9)),this.obj9):t.UNDEFINED},e.prototype.getObjAtIndex=function(e){if(0==e)return this.obj0;if(1==e)return this.obj1;if(2==e)return this.obj2;if(3==e)return this.obj3;if(4==e)return this.obj4;if(5==e)return this.obj5;if(6==e)return this.obj6;if(7==e)return this.obj7;if(8==e)return this.obj8;if(9==e)return this.obj9;throw new l.OutOfBoundsError(e)},e.prototype.getMaxNumberOfObjects=function(){return f},e}();t.InjectorInlineStrategy=y;var _=function(){function e(e,r){this.protoStrategy=e,this.injector=r,this.objs=s.ListWrapper.createFixedSize(e.bindings.length),s.ListWrapper.fill(this.objs,t.UNDEFINED)}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){for(var i=this.protoStrategy,o=0;oe||e>=this.objs.length)throw new l.OutOfBoundsError(e);return this.objs[e]},e.prototype.getMaxNumberOfObjects=function(){return this.objs.length},e}();t.InjectorDynamicStrategy=_;var b=function(){function e(e,t){this.binding=e,this.visibility=t}return e.prototype.getKeyId=function(){return this.binding.key.id},e}();t.BindingWithVisibility=b;var w=function(){function e(e,t,r,n){void 0===t&&(t=null),void 0===r&&(r=null),void 0===n&&(n=null),this._proto=e,this._parent=t,this._depProvider=r,this._debugContext=n,this._isHost=!1,this._constructionCounter=0,this._strategy=e._strategy.createInjectorStrategy(this)}return e.resolve=function(e){return c.resolveBindings(e)},e.resolveAndCreate=function(t){var r=e.resolve(t);return e.fromResolvedBindings(r)},e.fromResolvedBindings=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new v(r);return new e(n,null,null)},e.prototype.debugContext=function(){return this._debugContext()},e.prototype.get=function(e){return this._getByKey(p.Key.get(e),null,null,!1,h.PublicAndPrivate)},e.prototype.getOptional=function(e){return this._getByKey(p.Key.get(e),null,null,!0,h.PublicAndPrivate)},e.prototype.getAt=function(e){return this._strategy.getObjAtIndex(e)},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"internalStrategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),e.prototype.resolveAndCreateChild=function(t){var r=e.resolve(t);return this.createChildFromResolved(r)},e.prototype.createChildFromResolved=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new v(r),i=new e(n,null,null);return i._parent=this,i},e.prototype.resolveAndInstantiate=function(t){return this.instantiateResolved(e.resolve([t])[0])},e.prototype.instantiateResolved=function(e){return this._instantiateBinding(e,h.PublicAndPrivate)},e.prototype._new=function(e,t){if(this._constructionCounter++>this._strategy.getMaxNumberOfObjects())throw new l.CyclicDependencyError(this,e.key);return this._instantiateBinding(e,t)},e.prototype._instantiateBinding=function(e,t){if(e.multiBinding){for(var r=s.ListWrapper.createFixedSize(e.resolvedFactories.length),n=0;n0?this._getByDependency(e,R[0],r):null,i=x>1?this._getByDependency(e,R[1],r):null,o=x>2?this._getByDependency(e,R[2],r):null,a=x>3?this._getByDependency(e,R[3],r):null,s=x>4?this._getByDependency(e,R[4],r):null,c=x>5?this._getByDependency(e,R[5],r):null,u=x>6?this._getByDependency(e,R[6],r):null,p=x>7?this._getByDependency(e,R[7],r):null,d=x>8?this._getByDependency(e,R[8],r):null,f=x>9?this._getByDependency(e,R[9],r):null,h=x>10?this._getByDependency(e,R[10],r):null,g=x>11?this._getByDependency(e,R[11],r):null,m=x>12?this._getByDependency(e,R[12],r):null,v=x>13?this._getByDependency(e,R[13],r):null,y=x>14?this._getByDependency(e,R[14],r):null,_=x>15?this._getByDependency(e,R[15],r):null,b=x>16?this._getByDependency(e,R[16],r):null,w=x>17?this._getByDependency(e,R[17],r):null,C=x>18?this._getByDependency(e,R[18],r):null,E=x>19?this._getByDependency(e,R[19],r):null}catch(S){throw(S instanceof l.AbstractBindingError||S instanceof l.InstantiationError)&&S.addKey(this,e.key),S}var D;try{switch(x){case 0:D=P();break;case 1:D=P(n);break;case 2:D=P(n,i);break;case 3:D=P(n,i,o);break;case 4:D=P(n,i,o,a);break;case 5:D=P(n,i,o,a,s);break;case 6:D=P(n,i,o,a,s,c);break;case 7:D=P(n,i,o,a,s,c,u);break;case 8:D=P(n,i,o,a,s,c,u,p);break;case 9:D=P(n,i,o,a,s,c,u,p,d);break;case 10:D=P(n,i,o,a,s,c,u,p,d,f);break;case 11:D=P(n,i,o,a,s,c,u,p,d,f,h);break;case 12:D=P(n,i,o,a,s,c,u,p,d,f,h,g);break;case 13:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m);break;case 14:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v);break;case 15:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y);break;case 16:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_);break;case 17:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b);break;case 18:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w);break;case 19:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w,C);break;case 20:D=P(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w,C,E)}}catch(S){throw new l.InstantiationError(this,S,S.stack,e.key)}return D},e.prototype._getByDependency=function(e,r,n){var i=u.isPresent(this._depProvider)?this._depProvider.getDependency(this,e,r):t.UNDEFINED;return i!==t.UNDEFINED?i:this._getByKey(r.key,r.lowerBoundVisibility,r.upperBoundVisibility,r.optional,n)},e.prototype._getByKey=function(e,t,r,n,i){return e===C?this:r instanceof d.SelfMetadata?this._getByKeySelf(e,n,i):r instanceof d.HostMetadata?this._getByKeyHost(e,n,i,t):this._getByKeyDefault(e,n,i,t)},e.prototype._throwOrNull=function(e,t){if(t)return null;throw new l.NoBindingError(this,e)},e.prototype._getByKeySelf=function(e,r,n){var i=this._strategy.getObjByKeyId(e.id,n);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyHost=function(e,r,n,i){var o=this;if(i instanceof d.SkipSelfMetadata){if(o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}for(;null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;if(u.isPresent(o._parent)&&o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}return this._throwOrNull(e,r)},e.prototype._getPrivateDependency=function(e,r,n){var i=n._parent._strategy.getObjByKeyId(e.id,h.Private);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyDefault=function(e,r,n,i){var o=this;for(i instanceof d.SkipSelfMetadata&&(n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent);null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent}return this._throwOrNull(e,r)},Object.defineProperty(e.prototype,"displayName",{get:function(){return"Injector(bindings: ["+i(this,function(e){return' "'+e.key.displayName+'" '}).join(", ")+"])"},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.displayName},e}();t.Injector=w;var C=p.Key.get(w);return o.define=a,r.exports}),System.register("angular2/src/core/change_detection/change_detection_jit_generator",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/abstract_change_detector","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/codegen_name_util","angular2/src/core/change_detection/codegen_logic_util","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_change_detector"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/change_detection/abstract_change_detector"),c=e("angular2/src/core/change_detection/change_detection_util"),l=e("angular2/src/core/change_detection/codegen_name_util"),u=e("angular2/src/core/change_detection/codegen_logic_util"),p=e("angular2/src/core/change_detection/codegen_facade"),d=e("angular2/src/core/change_detection/proto_change_detector"),f="isChanged",h="changes",g=function(){function e(e,t,r){this.changeDetectionUtilVarName=t,this.abstractChangeDetectorVarName=r;var n=d.createPropertyRecords(e),i=d.createEventRecords(e),o=e.bindingRecords.map(function(e){return e.target});this.id=e.id,this.changeDetectionStrategy=e.strategy,this.genConfig=e.genConfig,this.records=n,this.propertyBindingTargets=o,this.eventBindings=i,this.directiveRecords=e.directiveRecords,this._names=new l.CodegenNameUtil(this.records,this.eventBindings,this.directiveRecords,this.changeDetectionUtilVarName),this._logic=new u.CodegenLogicUtil(this._names,this.changeDetectionUtilVarName,this.changeDetectionStrategy),this.typeName=l.sanitizeName("ChangeDetector_"+this.id)}return e.prototype.generate=function(){var e="\n "+this.generateSource()+"\n return function(dispatcher) {\n return new "+this.typeName+"(dispatcher);\n }\n ";return new Function(this.abstractChangeDetectorVarName,this.changeDetectionUtilVarName,e)(s.AbstractChangeDetector,c.ChangeDetectionUtil)},e.prototype.generateSource=function(){var e=this;return"\n var "+this.typeName+" = function "+this.typeName+"(dispatcher) {\n "+this.abstractChangeDetectorVarName+".call(\n this, "+JSON.stringify(this.id)+", dispatcher, "+this.records.length+",\n "+this.typeName+".gen_propertyBindingTargets, "+this.typeName+".gen_directiveIndices,\n "+p.codify(this.changeDetectionStrategy)+");\n this.dehydrateDirectives(false);\n }\n\n "+this.typeName+".prototype = Object.create("+this.abstractChangeDetectorVarName+".prototype);\n\n "+this.typeName+".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n "+this._names.genInitLocals()+"\n var "+f+" = false;\n var "+h+" = null;\n\n "+this.records.map(function(t){return e._genRecord(t)}).join("\n")+"\n }\n\n "+this._maybeGenHandleEventInternal()+"\n\n "+this._genCheckNoChanges()+"\n\n "+this._maybeGenAfterContentLifecycleCallbacks()+"\n\n "+this._maybeGenAfterViewLifecycleCallbacks()+"\n\n "+this._maybeGenHydrateDirectives()+"\n\n "+this._maybeGenDehydrateDirectives()+"\n\n "+this._genPropertyBindingTargets()+"\n\n "+this._genDirectiveIndices()+"\n "},e.prototype._genPropertyBindingTargets=function(){var e=this._logic.genPropertyBindingTargets(this.propertyBindingTargets,this.genConfig.genDebugInfo);return this.typeName+".gen_propertyBindingTargets = "+e+";"},e.prototype._genDirectiveIndices=function(){var e=this._logic.genDirectiveIndices(this.directiveRecords);return this.typeName+".gen_directiveIndices = "+e+";"},e.prototype._maybeGenHandleEventInternal=function(){var e=this;if(this.eventBindings.length>0){var t=this.eventBindings.map(function(t){return e._genEventBinding(t)}).join("\n");return"\n "+this.typeName+".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var "+this._names.getPreventDefaultAccesor()+" = false;\n "+this._names.genInitEventLocals()+"\n "+t+"\n return "+this._names.getPreventDefaultAccesor()+";\n }\n "}return""},e.prototype._genEventBinding=function(e){var t=this,r=e.records.map(function(r){return t._genEventBindingEval(e,r)}).join("\n");return'\n if (eventName === "'+e.eventName+'" && elIndex === '+e.elIndex+") {\n "+r+"\n }"},e.prototype._genEventBindingEval=function(e,t){if(t.lastInBinding){var r=this._logic.genEventBindingEvalValue(e,t),n=this._genMarkPathToRootAsCheckOnce(t),i=this._genUpdatePreventDefault(e,t);return r+"\n"+n+"\n"+i}return this._logic.genEventBindingEvalValue(e,t)},e.prototype._genMarkPathToRootAsCheckOnce=function(e){var t=e.bindingRecord;return t.isDefaultChangeDetection()?"":this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markPathToRootAsCheckOnce();"},e.prototype._genUpdatePreventDefault=function(e,t){var r=this._names.getEventLocalName(e,t.selfIndex);return"if ("+r+" === false) { "+this._names.getPreventDefaultAccesor()+" = true};"},e.prototype._maybeGenDehydrateDirectives=function(){var e=this._names.genPipeOnDestroy();e&&(e="if (destroyPipes) { "+e+" }");var t=this._names.genDehydrateFields();return e||t?this.typeName+".prototype.dehydrateDirectives = function(destroyPipes) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenHydrateDirectives=function(){var e=this._logic.genHydrateDirectives(this.directiveRecords),t=this._logic.genHydrateDetectors(this.directiveRecords);return e||t?this.typeName+".prototype.hydrateDirectives = function(directives) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenAfterContentLifecycleCallbacks=function(){var e=this._logic.genContentLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterContentLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._maybeGenAfterViewLifecycleCallbacks=function(){var e=this._logic.genViewLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterViewLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._genRecord=function(e){var t;return t=e.isLifeCycleRecord()?this._genDirectiveLifecycle(e):e.isPipeRecord()?this._genPipeCheck(e):this._genReferenceCheck(e),"\n "+this._maybeFirstInBinding(e)+"\n "+t+"\n "+this._maybeGenLastInDirective(e)+"\n "},e.prototype._genDirectiveLifecycle=function(e){if("DoCheck"===e.name)return this._genOnCheck(e);if("OnInit"===e.name)return this._genOnInit(e);if("OnChanges"===e.name)return this._genOnChange(e);throw new a.BaseException("Unknown lifecycle event '"+e.name+"'")},e.prototype._genPipeCheck=function(e){var t=this,r=this._names.getLocalName(e.contextIndex),n=e.args.map(function(e){return t._names.getLocalName(e); + +}).join(", "),i=this._names.getFieldName(e.selfIndex),o=this._names.getLocalName(e.selfIndex),a=this._names.getPipeName(e.selfIndex),s=e.name,c="\n if ("+a+" === "+this.changeDetectionUtilVarName+".uninitialized) {\n "+a+" = "+this._names.getPipesAccessorName()+".get('"+s+"');\n }\n ",l=o+" = "+a+".pipe.transform("+r+", ["+n+"]);",u=e.args.map(function(e){return t._names.getChangeName(e)});u.push(this._names.getChangeName(e.contextIndex));var p="!"+a+".pure || ("+u.join(" || ")+")",d="\n if ("+i+" !== "+o+") {\n "+o+" = "+this.changeDetectionUtilVarName+".unwrapValue("+o+")\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+i+" = "+o+";\n }\n ",f=e.shouldBeChecked()?""+l+d:l;return e.isUsedByOtherRecord()?c+" if ("+p+") { "+f+" } else { "+o+" = "+i+"; }":c+" if ("+p+") { "+f+" }"},e.prototype._genReferenceCheck=function(e){var t=this,r=this._names.getFieldName(e.selfIndex),n=this._names.getLocalName(e.selfIndex),i="\n "+this._logic.genPropertyBindingEvalValue(e)+"\n ",o="\n if ("+n+" !== "+r+") {\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+r+" = "+n+";\n }\n ",a=e.shouldBeChecked()?""+i+o:i;if(e.isPureFunction()){var s=e.args.map(function(e){return t._names.getChangeName(e)}).join(" || ");return e.isUsedByOtherRecord()?"if ("+s+") { "+a+" } else { "+n+" = "+r+"; }":"if ("+s+") { "+a+" }"}return a},e.prototype._genChangeMarker=function(e){return e.argumentToPureFunction?this._names.getChangeName(e.selfIndex)+" = true":""},e.prototype._genUpdateDirectiveOrElement=function(e){if(!e.lastInBinding)return"";var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex),n=this.genConfig.logBindingUpdate?"this.logBindingUpdate("+t+");":"",i=e.bindingRecord;if(i.target.isDirective()){var o=this._names.getDirectiveName(i.directiveRecord.directiveIndex)+"."+i.target.name;return"\n "+this._genThrowOnChangeCheck(r,t)+"\n "+o+" = "+t+";\n "+n+"\n "+f+" = true;\n "}return"\n "+this._genThrowOnChangeCheck(r,t)+"\n this.notifyDispatcher("+t+");\n "+n+"\n "},e.prototype._genThrowOnChangeCheck=function(e,t){return this.genConfig.genCheckNoChanges?"\n if(throwOnChange) {\n this.throwOnChangeError("+e+", "+t+");\n }\n ":""},e.prototype._genCheckNoChanges=function(){return this.genConfig.genCheckNoChanges?this.typeName+".prototype.checkNoChanges = function() { this.runDetectChanges(true); }":""},e.prototype._genAddToChanges=function(e){var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex);return e.bindingRecord.callOnChanges()?h+" = this.addChange("+h+", "+r+", "+t+");":""},e.prototype._maybeFirstInBinding=function(e){var t=c.ChangeDetectionUtil.protoByIndex(this.records,e.selfIndex-1),r=o.isBlank(t)||t.bindingRecord!==e.bindingRecord;return r&&!e.bindingRecord.isDirectiveLifecycle()?this._names.getPropertyBindingIndex()+" = "+e.propertyBindingIndex+";":""},e.prototype._maybeGenLastInDirective=function(e){return e.lastInDirective?"\n "+h+" = null;\n "+this._genNotifyOnPushDetectors(e)+"\n "+f+" = false;\n ":""},e.prototype._genOnCheck=function(e){var t=e.bindingRecord;return"if (!throwOnChange) "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".doCheck();"},e.prototype._genOnInit=function(e){var t=e.bindingRecord;return"if (!throwOnChange && !"+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onInit();"},e.prototype._genOnChange=function(e){var t=e.bindingRecord;return"if (!throwOnChange && "+h+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onChanges("+h+");"},e.prototype._genNotifyOnPushDetectors=function(e){var t=e.bindingRecord;if(!e.lastInDirective||t.isDefaultChangeDetection())return"";var r="\n if("+f+") {\n "+this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markAsCheckOnce();\n }\n ";return r},e}();return t.ChangeDetectorJITGenerator=g,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Subject",["@reactivex/rxjs/dist/cjs/Observable","@reactivex/rxjs/dist/cjs/Subscriber","@reactivex/rxjs/dist/cjs/Subscription","@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=System.global,s=a.define;a.define=void 0,t.__esModule=!0;var c=e("@reactivex/rxjs/dist/cjs/Observable"),l=n(c),u=e("@reactivex/rxjs/dist/cjs/Subscriber"),p=n(u),d=e("@reactivex/rxjs/dist/cjs/Subscription"),f=n(d),h=e("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"),g=n(h),m=f["default"].prototype.add,v=f["default"].prototype.remove,y=f["default"].prototype.unsubscribe,_=p["default"].prototype.next,b=p["default"].prototype.error,w=p["default"].prototype.complete,C=p["default"].prototype._next,E=p["default"].prototype._error,P=p["default"].prototype._complete,R=l["default"].prototype._subscribe,x=function(e){function t(){i(this,t);for(var r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];e.call.apply(e,[this].concat(n)),this.observers=[],this.isUnsubscribed=!1,this.dispatching=!1,this.errorSignal=!1,this.completeSignal=!1}return o(t,e),t.create=function(e,t){return new S(e,t)},t.prototype.lift=function(e){var t=new S(this,this.destination||this);return t.operator=e,t},t.prototype._subscribe=function(e){if(!e.isUnsubscribed){if(this.errorSignal)return void e.error(this.errorInstance);if(this.completeSignal)return void e.complete();if(this.isUnsubscribed)throw new Error("Cannot subscribe to a disposed Subject.");return this.observers.push(e),new g["default"](this,e)}},t.prototype.add=function(e){m.call(this,e)},t.prototype.remove=function(e){v.call(this,e)},t.prototype.unsubscribe=function(){this.observers=void 0,y.call(this)},t.prototype.next=function(e){this.isUnsubscribed||(this.dispatching=!0,this._next(e),this.dispatching=!1,this.errorSignal?this.error(this.errorInstance):this.completeSignal&&this.complete())},t.prototype.error=function(e){this.isUnsubscribed||this.completeSignal||(this.errorSignal=!0,this.errorInstance=e,this.dispatching||(this._error(e),this.unsubscribe()))},t.prototype.complete=function(){this.isUnsubscribed||this.errorSignal||(this.completeSignal=!0,this.dispatching||(this._complete(),this.unsubscribe()))},t.prototype._next=function(e){for(var t=-1,r=this.observers.slice(0),n=r.length;++t0?this._renderer.detachFragment(i.renderFragment):(this._renderer.dehydrateView(i.render),this._renderer.detachFragment(i.renderFragment),this._destroyPooledView(i))},e.prototype._viewDehydrateRecurse=function(e){e.hydrated()&&this._utils.dehydrateView(e);for(var t=e.viewContainers,r=e.viewOffset,n=e.viewOffset+e.mainMergeMapping.nestedViewCountByViewIndex[e.viewOffset],i=e.elementOffset,o=r;n>=o;o++)for(var a=e.views[o],s=0;s=0;u--)this._destroyViewInContainer(a,i,u)}},e=o([s.Injectable(),a("design:paramtypes",[f.AppViewPool,h.AppViewListener,d.AppViewManagerUtils,p.Renderer])],e)}();return t.AppViewManager=m,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/compiler",["angular2/src/core/di","angular2/src/core/facade/async","angular2/src/core/dom/dom_adapter","angular2/src/core/render/api","angular2/src/core/render/dom/compiler/compile_pipeline","angular2/src/core/facade/exceptions","angular2/src/core/render/dom/compiler/view_loader","angular2/src/core/render/dom/compiler/compile_step_factory","angular2/src/core/render/dom/schema/element_schema_registry","angular2/src/core/change_detection/change_detection","angular2/src/core/render/dom/view/proto_view_merger","angular2/src/core/render/dom/compiler/selector","angular2/src/core/render/dom/dom_tokens","angular2/src/core/render/dom/view/shared_styles_host","angular2/src/core/render/dom/util","angular2/src/core/render/dom/template_cloner"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/di"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/dom/dom_adapter"),d=e("angular2/src/core/render/api"),f=e("angular2/src/core/render/dom/compiler/compile_pipeline"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/render/dom/compiler/view_loader"),m=e("angular2/src/core/render/dom/compiler/compile_step_factory"),v=e("angular2/src/core/render/dom/schema/element_schema_registry"),y=e("angular2/src/core/change_detection/change_detection"),_=e("angular2/src/core/render/dom/view/proto_view_merger"),b=e("angular2/src/core/render/dom/compiler/selector"),w=e("angular2/src/core/render/dom/dom_tokens"),C=e("angular2/src/core/render/dom/view/shared_styles_host"),E=e("angular2/src/core/render/dom/util"),P=e("angular2/src/core/render/dom/template_cloner"),R=function(e){function t(t,r,n,i,o){e.call(this),this._schemaRegistry=t,this._templateCloner=r,this._stepFactory=n,this._viewLoader=i,this._sharedStylesHost=o}return o(t,e),t.prototype.compile=function(e){var t=this,r=this._viewLoader.load(e);return u.PromiseWrapper.then(r,function(r){return t._compileView(e,r,d.ViewType.COMPONENT)},function(t){throw new h.BaseException('Failed to load the template for "'+e.componentId+'" : '+t)})},t.prototype.compileHost=function(e){var t=new d.ViewDefinition({componentId:e.id,templateAbsUrl:null,template:null,styles:null,styleAbsUrls:null,directives:[e],encapsulation:d.ViewEncapsulation.None}),r=b.CssSelector.parse(e.selector)[0],n=r.getMatchingElementTemplate(),i=new g.TemplateAndStyles(n,[]);return this._compileView(t,i,d.ViewType.HOST)},t.prototype.mergeProtoViewsRecursively=function(e){return u.PromiseWrapper.resolve(_.mergeProtoViewsRecursively(this._templateCloner,e))},t.prototype._compileView=function(e,t,r){e.encapsulation===d.ViewEncapsulation.Emulated&&0===t.styles.length&&(e=this._normalizeViewEncapsulationIfThereAreNoStyles(e));var n=new f.CompilePipeline(this._stepFactory.createSteps(e)),i=n.processStyles(t.styles),o=n.processElements(this._createTemplateElm(t.template),r,e);return e.encapsulation===d.ViewEncapsulation.Native?E.prependAll(p.DOM.content(o[0].element),i.map(function(e){return p.DOM.createStyleElement(e)})):this._sharedStylesHost.addStyles(i),u.PromiseWrapper.resolve(o[0].inheritedProtoView.build(this._schemaRegistry,this._templateCloner))},t.prototype._createTemplateElm=function(e){for(var t=p.DOM.createTemplate(e),r=p.DOM.querySelectorAll(p.DOM.templateAwareRoot(t),"script"),n=0;n1)throw new l.BaseException("A directive injectable can contain only one of the following @Attribute or @Query.")},t.createFrom=function(e){return new t(e.key,e.optional,e.lowerBoundVisibility,e.upperBoundVisibility,e.properties,t._attributeName(e.properties),t._query(e.properties))},t._attributeName=function(e){var t=p.ListWrapper.find(e,function(e){return e instanceof g.AttributeMetadata});return c.isPresent(t)?t.attributeName:null},t._query=function(e){return p.ListWrapper.find(e,function(e){return e instanceof g.QueryMetadata})},t}(d.Dependency);t.DirectiveDependency=A;var T=function(e){function t(t,r,n,i,o,a){e.call(this,t,[new h.ResolvedFactory(r,n)],!1),this.metadata=i,this.bindings=o,this.viewBindings=a}return s(t,e),Object.defineProperty(t.prototype,"displayName",{get:function(){return this.key.displayName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callOnDestroy",{get:function(){return this.metadata.callOnDestroy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queries",{get:function(){if(c.isBlank(this.metadata.queries))return[];var e=[];return p.StringMapWrapper.forEach(this.metadata.queries,function(t,r){var n=P.reflector.setter(r);e.push(new N(n,t))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventEmitters",{get:function(){return c.isPresent(this.metadata)&&c.isPresent(this.metadata.events)?this.metadata.events:[]},enumerable:!0,configurable:!0}),t.createFromBinding=function(e,r){c.isBlank(r)&&(r=new b.DirectiveMetadata);var n=h.resolveBinding(e),i=n.resolvedFactories[0],o=i.dependencies.map(A.createFrom),a=e.token,s=R.RenderDirectiveMetadata.create({id:c.stringify(e.token),type:r instanceof b.ComponentMetadata?R.RenderDirectiveMetadata.COMPONENT_TYPE:R.RenderDirectiveMetadata.DIRECTIVE_TYPE,selector:r.selector,compileChildren:r.compileChildren,events:r.events,host:c.isPresent(r.host)?p.MapWrapper.createFromStringMap(r.host):null,properties:r.properties,readAttributes:t._readAttributes(o),queries:r.queries,callOnDestroy:w.hasLifecycleHook(D.LifecycleHooks.OnDestroy,a),callOnChanges:w.hasLifecycleHook(D.LifecycleHooks.OnChanges,a),callDoCheck:w.hasLifecycleHook(D.LifecycleHooks.DoCheck,a),callOnInit:w.hasLifecycleHook(D.LifecycleHooks.OnInit,a),callAfterContentInit:w.hasLifecycleHook(D.LifecycleHooks.AfterContentInit,a),callAfterContentChecked:w.hasLifecycleHook(D.LifecycleHooks.AfterContentChecked,a),callAfterViewInit:w.hasLifecycleHook(D.LifecycleHooks.AfterViewInit,a),callAfterViewChecked:w.hasLifecycleHook(D.LifecycleHooks.AfterViewChecked,a),changeDetection:r instanceof b.ComponentMetadata?r.changeDetection:null,exportAs:r.exportAs}),l=c.isPresent(r.bindings)?r.bindings:[],u=r instanceof b.ComponentMetadata&&c.isPresent(r.viewBindings)?r.viewBindings:[];return new t(n.key,i.factory,o,s,l,u)},t._readAttributes=function(e){var t=[];return e.forEach(function(e){c.isPresent(e.attributeName)&&t.push(e.attributeName)}),t},t.createFromType=function(e,r){var n=new d.Binding(e,{toClass:e});return t.createFromBinding(n,r)},t}(d.ResolvedBinding);t.DirectiveBinding=T;var M=function(){function e(e,t,r,n){this.viewManager=e,this.view=t,this.elementRef=r,this.templateRef=n}return e}();t.PreBuiltObjects=M;var N=function(){function e(e,t){this.setter=e,this.metadata=t}return e}();t.QueryMetadataWithSetter=N;var k=function(){function e(e,t){this.eventName=e,this.getter=t}return e.prototype.subscribe=function(e,t,r){var n=this,i=this.getter(r);return u.ObservableWrapper.subscribe(i,function(r){return e.triggerEventHandlers(n.eventName,r,t)})},e}();t.EventEmitterAccessor=k;var B=function(){function e(e,t,r,i,o,a){this.parent=e,this.index=t,this.distanceToParent=i,this._firstBindingIsComponent=o,this.directiveVariableBindings=a;var s=r.length;this.protoInjector=new f.ProtoInjector(r),this.eventEmitterAccessors=p.ListWrapper.createFixedSize(s);for(var c=0;s>c;++c)this.eventEmitterAccessors[c]=n(r[c])}return e.create=function(t,r,n,i,o,a){var s=[];return e._createDirectiveBindingWithVisibility(n,s,i),i&&e._createViewBindingsWithVisibility(n,s),e._createBindingsWithVisibility(n,s),new e(t,r,s,o,i,a)},e._createDirectiveBindingWithVisibility=function(t,r,n){t.forEach(function(i){r.push(e._createBindingWithVisibility(n,i,t,i))})},e._createBindingsWithVisibility=function(e,t){var r=[];e.forEach(function(e){r=p.ListWrapper.concat(r,e.bindings)});var n=d.Injector.resolve(r);n.forEach(function(e){return t.push(new f.BindingWithVisibility(e,f.Visibility.Public))})},e._createBindingWithVisibility=function(e,t,r,n){var i=e&&r[0]===t;return new f.BindingWithVisibility(n,i?f.Visibility.PublicAndPrivate:f.Visibility.Public)},e._createViewBindingsWithVisibility=function(e,t){var r=d.Injector.resolve(e[0].viewBindings);r.forEach(function(e){return t.push(new f.BindingWithVisibility(e,f.Visibility.Private))})},e.prototype.instantiate=function(e){return new j(this,e)},e.prototype.directParent=function(){return this.distanceToParent<2?this.parent:null},Object.defineProperty(e.prototype,"hasBindings",{get:function(){return this.eventEmitterAccessors.length>0},enumerable:!0,configurable:!0}),e.prototype.getBindingAtIndex=function(e){return this.protoInjector.getBindingAtIndex(e)},e}();t.ProtoElementInjector=B;var V=function(){function e(e,t,r){this.element=e,this.componentElement=t,this.injector=r}return e}(),j=function(e){function t(t,r){var n=this;e.call(this,r),this._proto=t,this._preBuiltObjects=null,this._injector=new d.Injector(this._proto.protoInjector,null,this,function(){return n._debugContext()});var i=this._injector.internalStrategy;this._strategy=i instanceof f.InjectorInlineStrategy?new L(i,this):new F(i,this),this.hydrated=!1,this._buildQueries()}return s(t,e),t.prototype.dehydrate=function(){this.hydrated=!1,this._host=null,this._preBuiltObjects=null,this._strategy.callOnDestroy(),this._strategy.dehydrate(),this._clearQueryLists()},t.prototype.hydrate=function(e,t,r){this._host=t,this._preBuiltObjects=r,this._reattachInjectors(e),this._strategy.hydrate(),this.hydrated=!0},t.prototype.updateLocalQueries=function(){c.isPresent(this._query0)&&!this._query0.isViewQuery&&(this._query0.update(),this._query0.list.fireCallbacks()),c.isPresent(this._query1)&&!this._query1.isViewQuery&&(this._query1.update(),this._query1.list.fireCallbacks()),c.isPresent(this._query2)&&!this._query2.isViewQuery&&(this._query2.update(),this._query2.list.fireCallbacks())},t.prototype.updateLocalViewQueries=function(){c.isPresent(this._query0)&&this._query0.isViewQuery&&(this._query0.update(),this._query0.list.fireCallbacks()),c.isPresent(this._query1)&&this._query1.isViewQuery&&(this._query1.update(),this._query1.list.fireCallbacks()),c.isPresent(this._query2)&&this._query2.isViewQuery&&(this._query2.update(),this._query2.list.fireCallbacks())},t.prototype._debugContext=function(){var e=this._preBuiltObjects,t=e.elementRef.boundElementIndex-e.view.elementOffset,r=this._preBuiltObjects.view.getDebugContext(t,null);return c.isPresent(r)?new V(r.element,r.componentElement,r.injector):null},t.prototype._reattachInjectors=function(e){c.isPresent(this._parent)?c.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._parent._injector,!1)):this._reattachInjector(this._injector,this._parent._injector,!1):c.isPresent(this._host)?c.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._host._injector,!0)):this._reattachInjector(this._injector,this._host._injector,!0):c.isPresent(e)&&this._reattachInjector(this._injector,e,!0)},t.prototype._reattachInjector=function(e,t,r){e.internalStrategy.attach(t,r)},t.prototype.hasVariableBinding=function(e){var t=this._proto.directiveVariableBindings;return c.isPresent(t)&&t.has(e)},t.prototype.getVariableBinding=function(e){var t=this._proto.directiveVariableBindings.get(e);return c.isPresent(t)?this.getDirectiveAtIndex(t):this.getElementRef()},t.prototype.get=function(e){return this._injector.get(e)},t.prototype.hasDirective=function(e){return c.isPresent(this._injector.getOptional(e))},t.prototype.getEventEmitterAccessors=function(){return this._proto.eventEmitterAccessors},t.prototype.getDirectiveVariableBindings=function(){return this._proto.directiveVariableBindings},t.prototype.getComponent=function(){return this._strategy.getComponent()},t.prototype.getInjector=function(){return this._injector},t.prototype.getElementRef=function(){return this._preBuiltObjects.elementRef},t.prototype.getViewContainerRef=function(){return new v.ViewContainerRef(this._preBuiltObjects.viewManager,this.getElementRef())},t.prototype.getView=function(){return this._preBuiltObjects.view},t.prototype.directParent=function(){return this._proto.distanceToParent<2?this.parent:null},t.prototype.isComponentKey=function(e){return this._strategy.isComponentKey(e)},t.prototype.getDependency=function(e,t,r){var n=r.key;if(t instanceof T){var i=r,o=t,a=I.instance();if(n.id===a.viewManagerId)return this._preBuiltObjects.viewManager;if(c.isPresent(i.attributeName))return this._buildAttribute(i);if(c.isPresent(i.queryDecorator))return this._findQuery(i.queryDecorator).list;if(i.key.id===I.instance().changeDetectorRefId){if(o.metadata.type===R.RenderDirectiveMetadata.COMPONENT_TYPE){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return this._preBuiltObjects.view.changeDetector.ref}if(i.key.id===I.instance().elementRefId)return this.getElementRef();if(i.key.id===I.instance().viewContainerId)return this.getViewContainerRef();if(i.key.id===I.instance().templateRefId){if(c.isBlank(this._preBuiltObjects.templateRef)){if(i.optional)return null;throw new d.NoBindingError(null,i.key)}return this._preBuiltObjects.templateRef}}else if(t instanceof S.PipeBinding&&r.key.id===I.instance().changeDetectorRefId){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return f.UNDEFINED},t.prototype._buildAttribute=function(e){var t=this._proto.attributes;return c.isPresent(t)&&t.has(e.attributeName)?t.get(e.attributeName):null},t.prototype._buildQueriesForDeps=function(e){for(var t=0;t0?this.list.first:null):this.setter(e,this.list)}},e.prototype._update=function(){var e=[];if(this.query.isViewQuery){var t=this.originator.getView(),r=t.getNestedView(t.elementOffset+this.originator.getBoundElementIndex());c.isPresent(r)&&this._visitView(r,e)}else this._visit(this.originator,e);this.list.reset(e)},e.prototype._visit=function(e,t){for(var r=e.getView(),n=r.elementOffset+e._proto.index,i=n;in&&(c.isBlank(o)||c.isBlank(o.parent)||r.elementOffset+o.parent._proto.index0&&f.isPresent(g.DOM.parentElement(e))){for(var r=0;r0){var i=r[r.length-1],o=_.resolveInternalDomFragment(t);n(i,o),this.animateNodesEnter(o)}},t.prototype.animateNodesEnter=function(e){for(var t=0;t0&&n[0]===o&&(n[0]=t),r.fragments[0][0]=t}for(var a=new y.DomView(e,r.boundTextNodes,n),s=e.elementBinders,c=0;c is used within the recursive path of "+u.stringify(a));if(e.type===R.ViewType.COMPONENT)throw new p.BaseException("Unconditional component cycle in "+u.stringify(a));s(r.get(a))}else{var c=n._compile(o,r);u.isPromise(c)?i.push(c.then(s)):s(c)}})}),d.PromiseWrapper.all(i).then(function(t){return d.PromiseWrapper.all(e.map(function(e){return n._mergeProtoView(e)}))}).then(function(t){return e[0]})},e.prototype._mergeProtoView=function(e){return e.type!==R.ViewType.HOST&&e.type!==R.ViewType.EMBEDDED?null:this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(e)).then(function(t){e.mergeMapping=new g.AppProtoViewMergeMapping(t)})},e.prototype._collectMergeRenderProtoViews=function(e){for(var t=[e.render],r=0;r0?o=this._urlResolver.resolve(i,t.templateUrl):u.isPresent(t.template)&&(o=i),u.isPresent(t.styleUrls)&&(a=f.ListWrapper.map(t.styleUrls,function(e){return n._urlResolver.resolve(i,e)})),new R.ViewDefinition({componentId:u.stringify(e),templateAbsUrl:o,template:t.template,styleAbsUrls:a,styles:t.styles,directives:f.ListWrapper.map(r,function(e){return e.metadata}),encapsulation:t.encapsulation})},e.prototype._flattenPipes=function(e){if(u.isBlank(e.pipes))return this._defaultPipes;var t=f.ListWrapper.clone(this._defaultPipes);return this._flattenList(e.pipes,t),t},e.prototype._flattenDirectives=function(e){if(u.isBlank(e.directives))return[];var t=[];return this._flattenList(e.directives,t),t},e.prototype._flattenList=function(e,t){for(var r=0;r -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchRequestAnimationFrame(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + + +/** + * requestAnimationFrame is typically recursively called from within the callback function + * that it executes. To handle this case, only fork a zone if this is executed + * within the root zone. + */ +function patchRequestAnimationFrame(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + global.zone[name] = function (fn) { + var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; + if (fn) { + arguments[0] = function () { + return callZone.run(fn, arguments); + }; + } + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchRequestAnimationFrame: patchRequestAnimationFrame, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (utils.isWebWorker()){ + // on WebWorker so don't apply patch + return; + } + + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (supportsWebSocket) { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + webSocketPatch.apply(); + } + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; +var utils = require("../utils"); + +function apply() { + if (utils.isWebWorker() || !('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function isWebWorker() { + return (typeof document === "undefined"); +} + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, handler) { + var fn; + //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (handler.toString() !== "[object FunctionWrapper]") { + if (handler.handleEvent) { + // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in + // IE9 by the arguments[1] assignment at end of this function. + fn = (function(handler) { + return function() { + handler.handleEvent.apply(handler, arguments); + }; + })(handler); + } else { + fn = handler; + } + + handler._fn = fn; + handler._bound = handler._bound || {}; + arguments[1] = handler._bound[eventName] = zone.bind(fn); + } + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, handler) { + if(handler._bound && handler._bound[eventName]) { + var _bound = handler._bound; + + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(handler._fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass, + isWebWorker: isWebWorker +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +(function(global) { + + var defined = {}; + + // indexOf polyfill for IE8 + var indexOf = Array.prototype.indexOf || function(item) { + for (var i = 0, l = this.length; i < l; i++) + if (this[i] === item) + return i; + return -1; + } + + function dedupe(deps) { + var newDeps = []; + for (var i = 0, l = deps.length; i < l; i++) + if (indexOf.call(newDeps, deps[i]) == -1) + newDeps.push(deps[i]) + return newDeps; + } + + function register(name, deps, declare, execute) { + if (typeof name != 'string') + throw "System.register provided no module name"; + + var entry; + + // dynamic + if (typeof declare == 'boolean') { + entry = { + declarative: false, + deps: deps, + execute: execute, + executingRequire: declare + }; + } + else { + // ES6 declarative + entry = { + declarative: true, + deps: deps, + declare: declare + }; + } + + entry.name = name; + + // we never overwrite an existing define + if (!(name in defined)) + defined[name] = entry; + + entry.deps = dedupe(entry.deps); + + // we have to normalize dependencies + // (assume dependencies are normalized for now) + // entry.normalizedDeps = entry.deps.map(normalize); + entry.normalizedDeps = entry.deps; + } + + function buildGroups(entry, groups) { + groups[entry.groupIndex] = groups[entry.groupIndex] || []; + + if (indexOf.call(groups[entry.groupIndex], entry) != -1) + return; + + groups[entry.groupIndex].push(entry); + + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + + // not in the registry means already linked / ES6 + if (!depEntry || depEntry.evaluated) + continue; + + // now we know the entry is in our unlinked linkage group + var depGroupIndex = entry.groupIndex + (depEntry.declarative != entry.declarative); + + // the group index of an entry is always the maximum + if (depEntry.groupIndex === undefined || depEntry.groupIndex < depGroupIndex) { + + // if already in a group, remove from the old group + if (depEntry.groupIndex !== undefined) { + groups[depEntry.groupIndex].splice(indexOf.call(groups[depEntry.groupIndex], depEntry), 1); + + // if the old group is empty, then we have a mixed depndency cycle + if (groups[depEntry.groupIndex].length == 0) + throw new TypeError("Mixed dependency cycle detected"); + } + + depEntry.groupIndex = depGroupIndex; + } + + buildGroups(depEntry, groups); + } + } + + function link(name) { + var startEntry = defined[name]; + + startEntry.groupIndex = 0; + + var groups = []; + + buildGroups(startEntry, groups); + + var curGroupDeclarative = !!startEntry.declarative == groups.length % 2; + for (var i = groups.length - 1; i >= 0; i--) { + var group = groups[i]; + for (var j = 0; j < group.length; j++) { + var entry = group[j]; + + // link each group + if (curGroupDeclarative) + linkDeclarativeModule(entry); + else + linkDynamicModule(entry); + } + curGroupDeclarative = !curGroupDeclarative; + } + } + + // module binding records + var moduleRecords = {}; + function getOrCreateModuleRecord(name) { + return moduleRecords[name] || (moduleRecords[name] = { + name: name, + dependencies: [], + exports: {}, // start from an empty module and extend + importers: [] + }) + } + + function linkDeclarativeModule(entry) { + // only link if already not already started linking (stops at circular) + if (entry.module) + return; + + var module = entry.module = getOrCreateModuleRecord(entry.name); + var exports = entry.module.exports; + + var declaration = entry.declare.call(global, function(name, value) { + module.locked = true; + exports[name] = value; + + for (var i = 0, l = module.importers.length; i < l; i++) { + var importerModule = module.importers[i]; + if (!importerModule.locked) { + var importerIndex = indexOf.call(importerModule.dependencies, module); + importerModule.setters[importerIndex](exports); + } + } + + module.locked = false; + return value; + }); + + module.setters = declaration.setters; + module.execute = declaration.execute; + + if (!module.setters || !module.execute) + throw new TypeError("Invalid System.register form for " + entry.name); + + // now link all the module dependencies + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + var depModule = moduleRecords[depName]; + + // work out how to set depExports based on scenarios... + var depExports; + + if (depModule) { + depExports = depModule.exports; + } + else if (depEntry && !depEntry.declarative) { + if (depEntry.module.exports && depEntry.module.exports.__esModule) + depExports = depEntry.module.exports; + else + depExports = { 'default': depEntry.module.exports, __useDefault: true }; + } + // in the module registry + else if (!depEntry) { + depExports = load(depName); + } + // we have an entry -> link + else { + linkDeclarativeModule(depEntry); + depModule = depEntry.module; + depExports = depModule.exports; + } + + // only declarative modules have dynamic bindings + if (depModule && depModule.importers) { + depModule.importers.push(module); + module.dependencies.push(depModule); + } + else + module.dependencies.push(null); + + // run the setter for this dependency + if (module.setters[i]) + module.setters[i](depExports); + } + } + + // An analog to loader.get covering execution of all three layers (real declarative, simulated declarative, simulated dynamic) + function getModule(name) { + var exports; + var entry = defined[name]; + + if (!entry) { + exports = load(name); + if (!exports) + throw new Error("Unable to load dependency " + name + "."); + } + + else { + if (entry.declarative) + ensureEvaluated(name, []); + + else if (!entry.evaluated) + linkDynamicModule(entry); + + exports = entry.module.exports; + } + + if ((!entry || entry.declarative) && exports && exports.__useDefault) + return exports['default']; + + return exports; + } + + function linkDynamicModule(entry) { + if (entry.module) + return; + + var exports = {}; + + var module = entry.module = { exports: exports, id: entry.name }; + + // AMD requires execute the tree first + if (!entry.executingRequire) { + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + if (depEntry) + linkDynamicModule(depEntry); + } + } + + // now execute + entry.evaluated = true; + var output = entry.execute.call(global, function(name) { + for (var i = 0, l = entry.deps.length; i < l; i++) { + if (entry.deps[i] != name) + continue; + return getModule(entry.normalizedDeps[i]); + } + throw new TypeError('Module ' + name + ' not declared as a dependency.'); + }, exports, module); + + if (output) + module.exports = output; + } + + /* + * Given a module, and the list of modules for this current branch, + * ensure that each of the dependencies of this module is evaluated + * (unless one is a circular dependency already in the list of seen + * modules, in which case we execute it) + * + * Then we evaluate the module itself depth-first left to right + * execution to match ES6 modules + */ + function ensureEvaluated(moduleName, seen) { + var entry = defined[moduleName]; + + // if already seen, that means it's an already-evaluated non circular dependency + if (!entry || entry.evaluated || !entry.declarative) + return; + + // this only applies to declarative modules which late-execute + + seen.push(moduleName); + + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + if (indexOf.call(seen, depName) == -1) { + if (!defined[depName]) + load(depName); + else + ensureEvaluated(depName, seen); + } + } + + if (entry.evaluated) + return; + + entry.evaluated = true; + entry.module.execute.call(global); + } + + // magical execution function + var modules = {}; + function load(name) { + if (modules[name]) + return modules[name]; + + var entry = defined[name]; + + // first we check if this module has already been defined in the registry + if (!entry) + throw "Module " + name + " not present."; + + // recursively ensure that the module and all its + // dependencies are linked (with dependency group handling) + link(name); + + // now handle dependency execution in correct order + ensureEvaluated(name, []); + + // remove from the registry + defined[name] = undefined; + + var module = entry.module.exports; + + if (!module || !entry.declarative && module.__esModule !== true) + module = { 'default': module, __useDefault: true }; + + // return the defined module object + return modules[name] = module; + }; + + return function(mains, declare) { + + var System; + var System = { + register: register, + get: load, + set: function(name, module) { + modules[name] = module; + }, + newModule: function(module) { + return module; + }, + global: global + }; + System.set('@empty', {}); + + declare(System); + + for (var i = 0; i < mains.length; i++) + load(mains[i]); + } + +})(typeof window != 'undefined' ? window : global) +/* (['mainModule'], function(System) { + System.register(...); +}); */ + +(['angular2/angular2_sfx'], function(System) { + +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/profile", ["angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var profile_1 = require("angular2/src/core/profile/profile"); + exports.wtfCreateScope = profile_1.wtfCreateScope; + exports.wtfLeave = profile_1.wtfLeave; + exports.wtfStartTimeRange = profile_1.wtfStartTimeRange; + exports.wtfEndTimeRange = profile_1.wtfEndTimeRange; + global.define = __define; + return module.exports; +}); + +System.register("angular2/lifecycle_hooks", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/bootstrap", ["angular2/src/core/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var bootstrap_1 = require("angular2/src/core/bootstrap"); + exports.bootstrap = bootstrap_1.bootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/instruction", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var RouteParams = (function() { + function RouteParams(params) { + this.params = params; + } + RouteParams.prototype.get = function(param) { + return lang_1.normalizeBlank(collection_1.StringMapWrapper.get(this.params, param)); + }; + return RouteParams; + })(); + exports.RouteParams = RouteParams; + var Instruction = (function() { + function Instruction(component, child, auxInstruction) { + this.component = component; + this.child = child; + this.auxInstruction = auxInstruction; + } + Instruction.prototype.replaceChild = function(child) { + return new Instruction(this.component, child, this.auxInstruction); + }; + return Instruction; + })(); + exports.Instruction = Instruction; + var PrimaryInstruction = (function() { + function PrimaryInstruction(component, child, auxUrls) { + this.component = component; + this.child = child; + this.auxUrls = auxUrls; + } + return PrimaryInstruction; + })(); + exports.PrimaryInstruction = PrimaryInstruction; + function stringifyInstruction(instruction) { + var params = instruction.component.urlParams.length > 0 ? ('?' + instruction.component.urlParams.join('&')) : ''; + return instruction.component.urlPath + stringifyAux(instruction) + stringifyPrimary(instruction.child) + params; + } + exports.stringifyInstruction = stringifyInstruction; + function stringifyPrimary(instruction) { + if (lang_1.isBlank(instruction)) { + return ''; + } + var params = instruction.component.urlParams.length > 0 ? (';' + instruction.component.urlParams.join(';')) : ''; + return '/' + instruction.component.urlPath + params + stringifyAux(instruction) + stringifyPrimary(instruction.child); + } + function stringifyAux(instruction) { + var routes = []; + collection_1.StringMapWrapper.forEach(instruction.auxInstruction, function(auxInstruction, _) { + routes.push(stringifyPrimary(auxInstruction)); + }); + if (routes.length > 0) { + return '(' + routes.join('//') + ')'; + } + return ''; + } + var ComponentInstruction = (function() { + function ComponentInstruction(urlPath, urlParams, _recognizer, params) { + if (params === void 0) { + params = null; + } + this.urlPath = urlPath; + this.urlParams = urlParams; + this._recognizer = _recognizer; + this.params = params; + this.reuse = false; + } + Object.defineProperty(ComponentInstruction.prototype, "componentType", { + get: function() { + return this._recognizer.handler.componentType; + }, + enumerable: true, + configurable: true + }); + ComponentInstruction.prototype.resolveComponentType = function() { + return this._recognizer.handler.resolveComponentType(); + }; + Object.defineProperty(ComponentInstruction.prototype, "specificity", { + get: function() { + return this._recognizer.specificity; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentInstruction.prototype, "terminal", { + get: function() { + return this._recognizer.terminal; + }, + enumerable: true, + configurable: true + }); + ComponentInstruction.prototype.routeData = function() { + return this._recognizer.handler.data; + }; + return ComponentInstruction; + })(); + exports.ComponentInstruction = ComponentInstruction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/lifecycle_annotations_impl", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var RouteLifecycleHook = (function() { + function RouteLifecycleHook(name) { + this.name = name; + } + RouteLifecycleHook = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], RouteLifecycleHook); + return RouteLifecycleHook; + })(); + exports.RouteLifecycleHook = RouteLifecycleHook; + var CanActivate = (function() { + function CanActivate(fn) { + this.fn = fn; + } + CanActivate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Function])], CanActivate); + return CanActivate; + })(); + exports.CanActivate = CanActivate; + exports.canReuse = lang_1.CONST_EXPR(new RouteLifecycleHook("canReuse")); + exports.canDeactivate = lang_1.CONST_EXPR(new RouteLifecycleHook("canDeactivate")); + exports.onActivate = lang_1.CONST_EXPR(new RouteLifecycleHook("onActivate")); + exports.onReuse = lang_1.CONST_EXPR(new RouteLifecycleHook("onReuse")); + exports.onDeactivate = lang_1.CONST_EXPR(new RouteLifecycleHook("onDeactivate")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_data", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.ROUTE_DATA = lang_1.CONST_EXPR(new di_1.OpaqueToken('routeData')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/lifecycle_annotations", ["angular2/src/core/util/decorators", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/router/lifecycle_annotations_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + var lifecycle_annotations_impl_1 = require("angular2/src/router/lifecycle_annotations_impl"); + var lifecycle_annotations_impl_2 = require("angular2/src/router/lifecycle_annotations_impl"); + exports.canReuse = lifecycle_annotations_impl_2.canReuse; + exports.canDeactivate = lifecycle_annotations_impl_2.canDeactivate; + exports.onActivate = lifecycle_annotations_impl_2.onActivate; + exports.onReuse = lifecycle_annotations_impl_2.onReuse; + exports.onDeactivate = lifecycle_annotations_impl_2.onDeactivate; + exports.CanActivate = decorators_1.makeDecorator(lifecycle_annotations_impl_1.CanActivate); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/location_strategy", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var LocationStrategy = (function() { + function LocationStrategy() {} + LocationStrategy.prototype.path = function() { + throw _abstract(); + }; + LocationStrategy.prototype.pushState = function(ctx, title, url) { + throw _abstract(); + }; + LocationStrategy.prototype.forward = function() { + throw _abstract(); + }; + LocationStrategy.prototype.back = function() { + throw _abstract(); + }; + LocationStrategy.prototype.onPopState = function(fn) { + throw _abstract(); + }; + LocationStrategy.prototype.getBaseHref = function() { + throw _abstract(); + }; + return LocationStrategy; + })(); + exports.LocationStrategy = LocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/url_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var Url = (function() { + function Url(path, child, auxiliary, params) { + if (child === void 0) { + child = null; + } + if (auxiliary === void 0) { + auxiliary = lang_1.CONST_EXPR([]); + } + if (params === void 0) { + params = null; + } + this.path = path; + this.child = child; + this.auxiliary = auxiliary; + this.params = params; + } + Url.prototype.toString = function() { + return this.path + this._matrixParamsToString() + this._auxToString() + this._childString(); + }; + Url.prototype.segmentToString = function() { + return this.path + this._matrixParamsToString(); + }; + Url.prototype._auxToString = function() { + return this.auxiliary.length > 0 ? ('(' + this.auxiliary.map(function(sibling) { + return sibling.toString(); + }).join('//') + ')') : ''; + }; + Url.prototype._matrixParamsToString = function() { + if (lang_1.isBlank(this.params)) { + return ''; + } + return ';' + serializeParams(this.params).join(';'); + }; + Url.prototype._childString = function() { + return lang_1.isPresent(this.child) ? ('/' + this.child.toString()) : ''; + }; + return Url; + })(); + exports.Url = Url; + var RootUrl = (function(_super) { + __extends(RootUrl, _super); + function RootUrl(path, child, auxiliary, params) { + if (child === void 0) { + child = null; + } + if (auxiliary === void 0) { + auxiliary = lang_1.CONST_EXPR([]); + } + if (params === void 0) { + params = null; + } + _super.call(this, path, child, auxiliary, params); + } + RootUrl.prototype.toString = function() { + return this.path + this._auxToString() + this._childString() + this._queryParamsToString(); + }; + RootUrl.prototype.segmentToString = function() { + return this.path + this._queryParamsToString(); + }; + RootUrl.prototype._queryParamsToString = function() { + if (lang_1.isBlank(this.params)) { + return ''; + } + return '?' + serializeParams(this.params).join('&'); + }; + return RootUrl; + })(Url); + exports.RootUrl = RootUrl; + function pathSegmentsToUrl(pathSegments) { + var url = new Url(pathSegments[pathSegments.length - 1]); + for (var i = pathSegments.length - 2; i >= 0; i -= 1) { + url = new Url(pathSegments[i], url); + } + return url; + } + exports.pathSegmentsToUrl = pathSegmentsToUrl; + var SEGMENT_RE = lang_1.RegExpWrapper.create('^[^\\/\\(\\)\\?;=&]+'); + function matchUrlSegment(str) { + var match = lang_1.RegExpWrapper.firstMatch(SEGMENT_RE, str); + return lang_1.isPresent(match) ? match[0] : null; + } + var UrlParser = (function() { + function UrlParser() {} + UrlParser.prototype.peekStartsWith = function(str) { + return lang_1.StringWrapper.startsWith(this._remaining, str); + }; + UrlParser.prototype.capture = function(str) { + if (!lang_1.StringWrapper.startsWith(this._remaining, str)) { + throw new exceptions_1.BaseException("Expected \"" + str + "\"."); + } + this._remaining = this._remaining.substring(str.length); + }; + UrlParser.prototype.parse = function(url) { + this._remaining = url; + if (url == '' || url == '/') { + return new Url(''); + } + return this.parseRoot(); + }; + UrlParser.prototype.parseRoot = function() { + if (this.peekStartsWith('/')) { + this.capture('/'); + } + var path = matchUrlSegment(this._remaining); + this.capture(path); + var aux = []; + if (this.peekStartsWith('(')) { + aux = this.parseAuxiliaryRoutes(); + } + if (this.peekStartsWith(';')) { + this.parseMatrixParams(); + } + var child = null; + if (this.peekStartsWith('/') && !this.peekStartsWith('//')) { + this.capture('/'); + child = this.parseSegment(); + } + var queryParams = null; + if (this.peekStartsWith('?')) { + queryParams = this.parseQueryParams(); + } + return new RootUrl(path, child, aux, queryParams); + }; + UrlParser.prototype.parseSegment = function() { + if (this._remaining.length == 0) { + return null; + } + if (this.peekStartsWith('/')) { + this.capture('/'); + } + var path = matchUrlSegment(this._remaining); + this.capture(path); + var matrixParams = null; + if (this.peekStartsWith(';')) { + matrixParams = this.parseMatrixParams(); + } + var aux = []; + if (this.peekStartsWith('(')) { + aux = this.parseAuxiliaryRoutes(); + } + var child = null; + if (this.peekStartsWith('/') && !this.peekStartsWith('//')) { + this.capture('/'); + child = this.parseSegment(); + } + return new Url(path, child, aux, matrixParams); + }; + UrlParser.prototype.parseQueryParams = function() { + var params = {}; + this.capture('?'); + this.parseParam(params); + while (this._remaining.length > 0 && this.peekStartsWith('&')) { + this.capture('&'); + this.parseParam(params); + } + return params; + }; + UrlParser.prototype.parseMatrixParams = function() { + var params = {}; + while (this._remaining.length > 0 && this.peekStartsWith(';')) { + this.capture(';'); + this.parseParam(params); + } + return params; + }; + UrlParser.prototype.parseParam = function(params) { + var key = matchUrlSegment(this._remaining); + if (lang_1.isBlank(key)) { + return ; + } + this.capture(key); + var value = true; + if (this.peekStartsWith('=')) { + this.capture('='); + var valueMatch = matchUrlSegment(this._remaining); + if (lang_1.isPresent(valueMatch)) { + value = valueMatch; + this.capture(value); + } + } + params[key] = value; + }; + UrlParser.prototype.parseAuxiliaryRoutes = function() { + var routes = []; + this.capture('('); + while (!this.peekStartsWith(')') && this._remaining.length > 0) { + routes.push(this.parseSegment()); + if (this.peekStartsWith('//')) { + this.capture('//'); + } + } + this.capture(')'); + return routes; + }; + return UrlParser; + })(); + exports.UrlParser = UrlParser; + exports.parser = new UrlParser(); + function serializeParams(paramMap) { + var params = []; + if (lang_1.isPresent(paramMap)) { + collection_1.StringMapWrapper.forEach(paramMap, function(value, key) { + if (value == true) { + params.push(key); + } else { + params.push(key + '=' + value); + } + }); + } + return params; + } + exports.serializeParams = serializeParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_impl", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var RouteConfig = (function() { + function RouteConfig(configs) { + this.configs = configs; + } + RouteConfig = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Array])], RouteConfig); + return RouteConfig; + })(); + exports.RouteConfig = RouteConfig; + var Route = (function() { + function Route(_a) { + var path = _a.path, + component = _a.component, + as = _a.as, + data = _a.data; + this.path = path; + this.component = component; + this.as = as; + this.loader = null; + this.redirectTo = null; + this.data = data; + } + Route = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], Route); + return Route; + })(); + exports.Route = Route; + var AuxRoute = (function() { + function AuxRoute(_a) { + var path = _a.path, + component = _a.component, + as = _a.as; + this.data = null; + this.loader = null; + this.redirectTo = null; + this.path = path; + this.component = component; + this.as = as; + } + AuxRoute = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], AuxRoute); + return AuxRoute; + })(); + exports.AuxRoute = AuxRoute; + var AsyncRoute = (function() { + function AsyncRoute(_a) { + var path = _a.path, + loader = _a.loader, + as = _a.as, + data = _a.data; + this.path = path; + this.loader = loader; + this.as = as; + this.data = data; + } + AsyncRoute = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], AsyncRoute); + return AsyncRoute; + })(); + exports.AsyncRoute = AsyncRoute; + var Redirect = (function() { + function Redirect(_a) { + var path = _a.path, + redirectTo = _a.redirectTo; + this.as = null; + this.loader = null; + this.data = null; + this.path = path; + this.redirectTo = redirectTo; + } + Redirect = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], Redirect); + return Redirect; + })(); + exports.Redirect = Redirect; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/async_route_handler", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var AsyncRouteHandler = (function() { + function AsyncRouteHandler(_loader, data) { + this._loader = _loader; + this.data = data; + this._resolvedComponent = null; + } + AsyncRouteHandler.prototype.resolveComponentType = function() { + var _this = this; + if (lang_1.isPresent(this._resolvedComponent)) { + return this._resolvedComponent; + } + return this._resolvedComponent = this._loader().then(function(componentType) { + _this.componentType = componentType; + return componentType; + }); + }; + return AsyncRouteHandler; + })(); + exports.AsyncRouteHandler = AsyncRouteHandler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/sync_route_handler", ["angular2/src/core/facade/async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_1 = require("angular2/src/core/facade/async"); + var SyncRouteHandler = (function() { + function SyncRouteHandler(componentType, data) { + this.componentType = componentType; + this.data = data; + this._resolvedComponent = null; + this._resolvedComponent = async_1.PromiseWrapper.resolve(componentType); + } + SyncRouteHandler.prototype.resolveComponentType = function() { + return this._resolvedComponent; + }; + return SyncRouteHandler; + })(); + exports.SyncRouteHandler = SyncRouteHandler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/core/util/decorators", "angular2/src/router/route_config_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var decorators_1 = require("angular2/src/core/util/decorators"); + var route_config_impl_2 = require("angular2/src/router/route_config_impl"); + exports.Route = route_config_impl_2.Route; + exports.Redirect = route_config_impl_2.Redirect; + exports.AuxRoute = route_config_impl_2.AuxRoute; + exports.AsyncRoute = route_config_impl_2.AsyncRoute; + exports.RouteConfig = decorators_1.makeDecorator(route_config_impl_1.RouteConfig); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/hash_location_strategy", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/router/location_strategy"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var HashLocationStrategy = (function(_super) { + __extends(HashLocationStrategy, _super); + function HashLocationStrategy() { + _super.call(this); + this._location = dom_adapter_1.DOM.getLocation(); + this._history = dom_adapter_1.DOM.getHistory(); + } + HashLocationStrategy.prototype.onPopState = function(fn) { + dom_adapter_1.DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }; + HashLocationStrategy.prototype.getBaseHref = function() { + return ''; + }; + HashLocationStrategy.prototype.path = function() { + var path = this._location.hash; + return path.length > 0 ? path.substring(1) : path; + }; + HashLocationStrategy.prototype.pushState = function(state, title, url) { + this._history.pushState(state, title, '#' + url); + }; + HashLocationStrategy.prototype.forward = function() { + this._history.forward(); + }; + HashLocationStrategy.prototype.back = function() { + this._history.back(); + }; + HashLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HashLocationStrategy); + return HashLocationStrategy; + })(location_strategy_1.LocationStrategy); + exports.HashLocationStrategy = HashLocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/path_location_strategy", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/router/location_strategy"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var PathLocationStrategy = (function(_super) { + __extends(PathLocationStrategy, _super); + function PathLocationStrategy() { + _super.call(this); + this._location = dom_adapter_1.DOM.getLocation(); + this._history = dom_adapter_1.DOM.getHistory(); + this._baseHref = dom_adapter_1.DOM.getBaseHref(); + } + PathLocationStrategy.prototype.onPopState = function(fn) { + dom_adapter_1.DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }; + PathLocationStrategy.prototype.getBaseHref = function() { + return this._baseHref; + }; + PathLocationStrategy.prototype.path = function() { + return this._location.pathname; + }; + PathLocationStrategy.prototype.pushState = function(state, title, url) { + this._history.pushState(state, title, url); + }; + PathLocationStrategy.prototype.forward = function() { + this._history.forward(); + }; + PathLocationStrategy.prototype.back = function() { + this._history.back(); + }; + PathLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PathLocationStrategy); + return PathLocationStrategy; + })(location_strategy_1.LocationStrategy); + exports.PathLocationStrategy = PathLocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_definition", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + function paramParser(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + var map = new collection_1.Map(); + if (rawParams.length > 0) { + var params = lang_1.StringWrapper.split(rawParams, new RegExp('&')); + collection_1.ListWrapper.forEach(params, function(param) { + var split = lang_1.StringWrapper.split(param, new RegExp('=')); + var key = split[0]; + var val = split[1]; + var list = lang_1.isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + }); + } + return map; + } + exports.URLSearchParamsUnionFixer = lang_1.CONST_EXPR("UnionFixer"); + var URLSearchParams = (function() { + function URLSearchParams(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + URLSearchParams.prototype.clone = function() { + var clone = new URLSearchParams(); + clone.appendAll(this); + return clone; + }; + URLSearchParams.prototype.has = function(param) { + return this.paramsMap.has(param); + }; + URLSearchParams.prototype.get = function(param) { + var storedParam = this.paramsMap.get(param); + if (collection_1.isListLikeIterable(storedParam)) { + return collection_1.ListWrapper.first(storedParam); + } else { + return null; + } + }; + URLSearchParams.prototype.getAll = function(param) { + var mapParam = this.paramsMap.get(param); + return lang_1.isPresent(mapParam) ? mapParam : []; + }; + URLSearchParams.prototype.set = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.setAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(value[0]); + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.append = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.appendAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.replaceAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.toString = function() { + var paramsList = []; + collection_1.MapWrapper.forEach(this.paramsMap, function(values, k) { + collection_1.ListWrapper.forEach(values, function(v) { + paramsList.push(k + '=' + v); + }); + }); + return collection_1.ListWrapper.join(paramsList, '&'); + }; + URLSearchParams.prototype.delete = function(param) { + collection_1.MapWrapper.delete(this.paramsMap, param); + }; + return URLSearchParams; + })(); + exports.URLSearchParams = URLSearchParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/headers", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Headers = (function() { + function Headers(headers) { + var _this = this; + if (lang_1.isBlank(headers)) { + this._headersMap = new collection_1.Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof collection_1.StringMap) { + this._headersMap = collection_1.MapWrapper.createFromStringMap(headers); + collection_1.MapWrapper.forEach(this._headersMap, function(v, k) { + if (!collection_1.isListLikeIterable(v)) { + var list = []; + list.push(v); + _this._headersMap.set(k, list); + } + }); + } + } + Headers.prototype.append = function(name, value) { + var mapName = this._headersMap.get(name); + var list = collection_1.isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }; + Headers.prototype.delete = function(name) { + collection_1.MapWrapper.delete(this._headersMap, name); + }; + Headers.prototype.forEach = function(fn) { + collection_1.MapWrapper.forEach(this._headersMap, fn); + }; + Headers.prototype.get = function(header) { + return collection_1.ListWrapper.first(this._headersMap.get(header)); + }; + Headers.prototype.has = function(header) { + return this._headersMap.has(header); + }; + Headers.prototype.keys = function() { + return collection_1.MapWrapper.keys(this._headersMap); + }; + Headers.prototype.set = function(header, value) { + var list = []; + if (collection_1.isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }; + Headers.prototype.values = function() { + return collection_1.MapWrapper.values(this._headersMap); + }; + Headers.prototype.getAll = function(header) { + var headers = this._headersMap.get(header); + return collection_1.isListLikeIterable(headers) ? headers : []; + }; + Headers.prototype.entries = function() { + throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class'); + }; + return Headers; + })(); + exports.Headers = Headers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/enums", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RequestMethods) { + RequestMethods[RequestMethods["Get"] = 0] = "Get"; + RequestMethods[RequestMethods["Post"] = 1] = "Post"; + RequestMethods[RequestMethods["Put"] = 2] = "Put"; + RequestMethods[RequestMethods["Delete"] = 3] = "Delete"; + RequestMethods[RequestMethods["Options"] = 4] = "Options"; + RequestMethods[RequestMethods["Head"] = 5] = "Head"; + RequestMethods[RequestMethods["Patch"] = 6] = "Patch"; + })(exports.RequestMethods || (exports.RequestMethods = {})); + var RequestMethods = exports.RequestMethods; + (function(ReadyStates) { + ReadyStates[ReadyStates["Unsent"] = 0] = "Unsent"; + ReadyStates[ReadyStates["Open"] = 1] = "Open"; + ReadyStates[ReadyStates["HeadersReceived"] = 2] = "HeadersReceived"; + ReadyStates[ReadyStates["Loading"] = 3] = "Loading"; + ReadyStates[ReadyStates["Done"] = 4] = "Done"; + ReadyStates[ReadyStates["Cancelled"] = 5] = "Cancelled"; + })(exports.ReadyStates || (exports.ReadyStates = {})); + var ReadyStates = exports.ReadyStates; + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(exports.ResponseTypes || (exports.ResponseTypes = {})); + var ResponseTypes = exports.ResponseTypes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.isJsObject = lang_1.isJsObject; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var ResponseOptions = (function() { + function ResponseOptions(_a) { + var _b = _a === void 0 ? {} : _a, + body = _b.body, + status = _b.status, + headers = _b.headers, + statusText = _b.statusText, + type = _b.type, + url = _b.url; + this.body = lang_1.isPresent(body) ? body : null; + this.status = lang_1.isPresent(status) ? status : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.statusText = lang_1.isPresent(statusText) ? statusText : null; + this.type = lang_1.isPresent(type) ? type : null; + this.url = lang_1.isPresent(url) ? url : null; + } + ResponseOptions.prototype.merge = function(options) { + return new ResponseOptions({ + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + status: lang_1.isPresent(options) && lang_1.isPresent(options.status) ? options.status : this.status, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + statusText: lang_1.isPresent(options) && lang_1.isPresent(options.statusText) ? options.statusText : this.statusText, + type: lang_1.isPresent(options) && lang_1.isPresent(options.type) ? options.type : this.type, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url + }); + }; + return ResponseOptions; + })(); + exports.ResponseOptions = ResponseOptions; + var BaseResponseOptions = (function(_super) { + __extends(BaseResponseOptions, _super); + function BaseResponseOptions() { + _super.call(this, { + status: 200, + statusText: 'Ok', + type: enums_1.ResponseTypes.Default, + headers: new headers_1.Headers() + }); + } + BaseResponseOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions); + return BaseResponseOptions; + })(ResponseOptions); + exports.BaseResponseOptions = BaseResponseOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 BrowserXhr = (function() { + function BrowserXhr() {} + BrowserXhr.prototype.build = function() { + return (new XMLHttpRequest()); + }; + BrowserXhr = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserXhr); + return BrowserXhr; + })(); + exports.BrowserXhr = BrowserXhr; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/src/core/di", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var _nextRequestId = 0; + exports.JSONP_HOME = '__ng_jsonp__'; + var _jsonpConnections = null; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = lang_1.global[exports.JSONP_HOME] = {}; + } + return _jsonpConnections; + } + var BrowserJsonp = (function() { + function BrowserJsonp() {} + BrowserJsonp.prototype.build = function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }; + BrowserJsonp.prototype.nextRequestID = function() { + return "__req" + _nextRequestId++; + }; + BrowserJsonp.prototype.requestCallback = function(id) { + return exports.JSONP_HOME + "." + id + ".finished"; + }; + BrowserJsonp.prototype.exposeConnection = function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }; + BrowserJsonp.prototype.removeConnection = function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }; + BrowserJsonp.prototype.send = function(node) { + document.body.appendChild((node)); + }; + BrowserJsonp.prototype.cleanup = function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + }; + BrowserJsonp = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp); + return BrowserJsonp; + })(); + exports.BrowserJsonp = BrowserJsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/src/core/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 static_request_1 = require("angular2/src/http/static_request"); + var enums_1 = require("angular2/src/http/enums"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var MockConnection = (function() { + function MockConnection(req) { + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Open; + this.request = req; + } + MockConnection.prototype.dispose = function() { + if (this.readyState !== enums_1.ReadyStates.Done) { + this.readyState = enums_1.ReadyStates.Cancelled; + } + }; + MockConnection.prototype.mockRespond = function(res) { + if (this.readyState === enums_1.ReadyStates.Done || this.readyState === enums_1.ReadyStates.Cancelled) { + throw new exceptions_1.BaseException('Connection has already been resolved'); + } + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callNext(this.response, res); + async_1.ObservableWrapper.callReturn(this.response); + }; + MockConnection.prototype.mockDownload = function(res) {}; + MockConnection.prototype.mockError = function(err) { + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callThrow(this.response, err); + async_1.ObservableWrapper.callReturn(this.response); + }; + return MockConnection; + })(); + exports.MockConnection = MockConnection; + var MockBackend = (function() { + function MockBackend() { + var _this = this; + this.connectionsArray = []; + this.connections = new async_1.EventEmitter(); + async_1.ObservableWrapper.subscribe(this.connections, function(connection) { + return _this.connectionsArray.push(connection); + }); + this.pendingConnections = new async_1.EventEmitter(); + } + MockBackend.prototype.verifyNoPendingRequests = function() { + var pending = 0; + async_1.ObservableWrapper.subscribe(this.pendingConnections, function(c) { + return pending++; + }); + if (pending > 0) + throw new exceptions_1.BaseException(pending + " pending connections to be resolved"); + }; + MockBackend.prototype.resolveAllConnections = function() { + async_1.ObservableWrapper.subscribe(this.connections, function(c) { + return c.readyState = 4; + }); + }; + MockBackend.prototype.createConnection = function(req) { + if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) { + throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req); + } + var connection = new MockConnection(req); + async_1.ObservableWrapper.callNext(this.connections, connection); + return connection; + }; + MockBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend); + return MockBackend; + })(); + exports.MockBackend = MockBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lifecycle_annotations_impl_1 = require("angular2/src/router/lifecycle_annotations_impl"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + function hasLifecycleHook(e, type) { + if (!(type instanceof lang_1.Type)) + return false; + return e.name in type.prototype; + } + exports.hasLifecycleHook = hasLifecycleHook; + function getCanActivateHook(type) { + var annotations = reflection_1.reflector.annotations(type); + for (var i = 0; i < annotations.length; i += 1) { + var annotation = annotations[i]; + if (annotation instanceof lifecycle_annotations_impl_1.CanActivate) { + return annotation.fn; + } + } + return null; + } + exports.getCanActivateHook = getCanActivateHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router_outlet", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/router/router", "angular2/src/router/instruction", "angular2/src/router/route_data", "angular2/src/router/lifecycle_annotations", "angular2/src/router/route_lifecycle_reflector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var routerMod = require("angular2/src/router/router"); + var instruction_1 = require("angular2/src/router/instruction"); + var route_data_1 = require("angular2/src/router/route_data"); + var hookMod = require("angular2/src/router/lifecycle_annotations"); + var route_lifecycle_reflector_1 = require("angular2/src/router/route_lifecycle_reflector"); + var _resolveToTrue = async_1.PromiseWrapper.resolve(true); + var RouterOutlet = (function() { + function RouterOutlet(_elementRef, _loader, _parentRouter, nameAttr) { + this._elementRef = _elementRef; + this._loader = _loader; + this._parentRouter = _parentRouter; + this.name = null; + this._componentRef = null; + this._currentInstruction = null; + if (lang_1.isPresent(nameAttr)) { + this.name = nameAttr; + this._parentRouter.registerAuxOutlet(this); + } else { + this._parentRouter.registerPrimaryOutlet(this); + } + } + RouterOutlet.prototype.activate = function(nextInstruction) { + var _this = this; + var previousInstruction = this._currentInstruction; + this._currentInstruction = nextInstruction; + var componentType = nextInstruction.componentType; + var childRouter = this._parentRouter.childRouter(componentType); + var bindings = di_1.Injector.resolve([di_1.bind(route_data_1.ROUTE_DATA).toValue(nextInstruction.routeData()), di_1.bind(instruction_1.RouteParams).toValue(new instruction_1.RouteParams(nextInstruction.params)), di_1.bind(routerMod.Router).toValue(childRouter)]); + return this._loader.loadNextToLocation(componentType, this._elementRef, bindings).then(function(componentRef) { + _this._componentRef = componentRef; + if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onActivate, componentType)) { + return _this._componentRef.instance.onActivate(nextInstruction, previousInstruction); + } + }); + }; + RouterOutlet.prototype.reuse = function(nextInstruction) { + var previousInstruction = this._currentInstruction; + this._currentInstruction = nextInstruction; + if (lang_1.isBlank(this._componentRef)) { + throw new exceptions_1.BaseException("Cannot reuse an outlet that does not contain a component."); + } + return async_1.PromiseWrapper.resolve(route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onReuse, this._currentInstruction.componentType) ? this._componentRef.instance.onReuse(nextInstruction, previousInstruction) : true); + }; + RouterOutlet.prototype.deactivate = function(nextInstruction) { + var _this = this; + var next = _resolveToTrue; + if (lang_1.isPresent(this._componentRef) && lang_1.isPresent(this._currentInstruction) && route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onDeactivate, this._currentInstruction.componentType)) { + next = async_1.PromiseWrapper.resolve(this._componentRef.instance.onDeactivate(nextInstruction, this._currentInstruction)); + } + return next.then(function(_) { + if (lang_1.isPresent(_this._componentRef)) { + _this._componentRef.dispose(); + _this._componentRef = null; + } + }); + }; + RouterOutlet.prototype.canDeactivate = function(nextInstruction) { + if (lang_1.isBlank(this._currentInstruction)) { + return _resolveToTrue; + } + if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.canDeactivate, this._currentInstruction.componentType)) { + return async_1.PromiseWrapper.resolve(this._componentRef.instance.canDeactivate(nextInstruction, this._currentInstruction)); + } + return _resolveToTrue; + }; + RouterOutlet.prototype.canReuse = function(nextInstruction) { + var result; + if (lang_1.isBlank(this._currentInstruction) || this._currentInstruction.componentType != nextInstruction.componentType) { + result = false; + } else if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.canReuse, this._currentInstruction.componentType)) { + result = this._componentRef.instance.canReuse(nextInstruction, this._currentInstruction); + } else { + result = nextInstruction == this._currentInstruction || (lang_1.isPresent(nextInstruction.params) && lang_1.isPresent(this._currentInstruction.params) && collection_1.StringMapWrapper.equals(nextInstruction.params, this._currentInstruction.params)); + } + return async_1.PromiseWrapper.resolve(result); + }; + RouterOutlet = __decorate([metadata_1.Directive({selector: 'router-outlet'}), __param(3, metadata_1.Attribute('name')), __metadata('design:paramtypes', [compiler_1.ElementRef, compiler_1.DynamicComponentLoader, routerMod.Router, String])], RouterOutlet); + return RouterOutlet; + })(); + exports.RouterOutlet = RouterOutlet; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_2 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + exports.APP_BASE_HREF = lang_1.CONST_EXPR(new di_1.OpaqueToken('appBaseHref')); + var Location = (function() { + function Location(platformStrategy, href) { + var _this = this; + this.platformStrategy = platformStrategy; + this._subject = new async_1.EventEmitter(); + var browserBaseHref = lang_1.isPresent(href) ? href : this.platformStrategy.getBaseHref(); + if (lang_2.isBlank(browserBaseHref)) { + throw new exceptions_1.BaseException("No base href set. Either provide a binding to \"appBaseHrefToken\" or add a base element."); + } + this._baseHref = stripTrailingSlash(stripIndexHtml(browserBaseHref)); + this.platformStrategy.onPopState(function(_) { + async_1.ObservableWrapper.callNext(_this._subject, { + 'url': _this.path(), + 'pop': true + }); + }); + } + Location.prototype.path = function() { + return this.normalize(this.platformStrategy.path()); + }; + Location.prototype.normalize = function(url) { + return stripTrailingSlash(_stripBaseHref(this._baseHref, stripIndexHtml(url))); + }; + Location.prototype.normalizeAbsolutely = function(url) { + if (!url.startsWith('/')) { + url = '/' + url; + } + return stripTrailingSlash(_addBaseHref(this._baseHref, url)); + }; + Location.prototype.go = function(url) { + var finalUrl = this.normalizeAbsolutely(url); + this.platformStrategy.pushState(null, '', finalUrl); + }; + Location.prototype.forward = function() { + this.platformStrategy.forward(); + }; + Location.prototype.back = function() { + this.platformStrategy.back(); + }; + Location.prototype.subscribe = function(onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + async_1.ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + }; + Location = __decorate([di_1.Injectable(), __param(1, di_1.Optional()), __param(1, di_1.Inject(exports.APP_BASE_HREF)), __metadata('design:paramtypes', [location_strategy_1.LocationStrategy, String])], Location); + return Location; + })(); + exports.Location = Location; + function _stripBaseHref(baseHref, url) { + if (baseHref.length > 0 && url.startsWith(baseHref)) { + return url.substring(baseHref.length); + } + return url; + } + function _addBaseHref(baseHref, url) { + if (!url.startsWith(baseHref)) { + return baseHref + url; + } + return url; + } + function stripIndexHtml(url) { + if (/\/index.html$/g.test(url)) { + return url.substring(0, url.length - 11); + } + return url; + } + function stripTrailingSlash(url) { + if (/\/$/g.test(url)) { + url = url.substring(0, url.length - 1); + } + return url; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/path_recognizer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/router/url_parser", "angular2/src/router/instruction"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var instruction_1 = require("angular2/src/router/instruction"); + var TouchMap = (function() { + function TouchMap(map) { + var _this = this; + this.map = {}; + this.keys = {}; + if (lang_1.isPresent(map)) { + collection_1.StringMapWrapper.forEach(map, function(value, key) { + _this.map[key] = lang_1.isPresent(value) ? value.toString() : null; + _this.keys[key] = true; + }); + } + } + TouchMap.prototype.get = function(key) { + collection_1.StringMapWrapper.delete(this.keys, key); + return this.map[key]; + }; + TouchMap.prototype.getUnused = function() { + var _this = this; + var unused = collection_1.StringMapWrapper.create(); + var keys = collection_1.StringMapWrapper.keys(this.keys); + collection_1.ListWrapper.forEach(keys, function(key) { + unused[key] = collection_1.StringMapWrapper.get(_this.map, key); + }); + return unused; + }; + return TouchMap; + })(); + function normalizeString(obj) { + if (lang_1.isBlank(obj)) { + return null; + } else { + return obj.toString(); + } + } + var ContinuationSegment = (function() { + function ContinuationSegment() { + this.name = ''; + } + ContinuationSegment.prototype.generate = function(params) { + return ''; + }; + ContinuationSegment.prototype.match = function(path) { + return true; + }; + return ContinuationSegment; + })(); + var StaticSegment = (function() { + function StaticSegment(path) { + this.path = path; + this.name = ''; + } + StaticSegment.prototype.match = function(path) { + return path == this.path; + }; + StaticSegment.prototype.generate = function(params) { + return this.path; + }; + return StaticSegment; + })(); + var DynamicSegment = (function() { + function DynamicSegment(name) { + this.name = name; + } + DynamicSegment.prototype.match = function(path) { + return path.length > 0; + }; + DynamicSegment.prototype.generate = function(params) { + if (!collection_1.StringMapWrapper.contains(params.map, this.name)) { + throw new exceptions_1.BaseException("Route generator for '" + this.name + "' was not included in parameters passed."); + } + return normalizeString(params.get(this.name)); + }; + return DynamicSegment; + })(); + var StarSegment = (function() { + function StarSegment(name) { + this.name = name; + } + StarSegment.prototype.match = function(path) { + return true; + }; + StarSegment.prototype.generate = function(params) { + return normalizeString(params.get(this.name)); + }; + return StarSegment; + })(); + var paramMatcher = /^:([^\/]+)$/g; + var wildcardMatcher = /^\*([^\/]+)$/g; + function parsePathString(route) { + if (lang_1.StringWrapper.startsWith(route, "/")) { + route = lang_1.StringWrapper.substring(route, 1); + } + var segments = splitBySlash(route); + var results = []; + var specificity = 0; + if (segments.length > 98) { + throw new exceptions_1.BaseException("'" + route + "' has more than the maximum supported number of segments."); + } + var limit = segments.length - 1; + for (var i = 0; i <= limit; i++) { + var segment = segments[i], + match; + if (lang_1.isPresent(match = lang_1.RegExpWrapper.firstMatch(paramMatcher, segment))) { + results.push(new DynamicSegment(match[1])); + specificity += (100 - i); + } else if (lang_1.isPresent(match = lang_1.RegExpWrapper.firstMatch(wildcardMatcher, segment))) { + results.push(new StarSegment(match[1])); + } else if (segment == '...') { + if (i < limit) { + throw new exceptions_1.BaseException("Unexpected \"...\" before the end of the path for \"" + route + "\"."); + } + results.push(new ContinuationSegment()); + } else { + results.push(new StaticSegment(segment)); + specificity += 100 * (100 - i); + } + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'segments', results); + collection_1.StringMapWrapper.set(result, 'specificity', specificity); + return result; + } + function pathDslHash(segments) { + return segments.map(function(segment) { + if (segment instanceof StarSegment) { + return '*'; + } else if (segment instanceof ContinuationSegment) { + return '...'; + } else if (segment instanceof DynamicSegment) { + return ':'; + } else if (segment instanceof StaticSegment) { + return segment.path; + } + }).join('/'); + } + function splitBySlash(url) { + return url.split('/'); + } + var RESERVED_CHARS = lang_1.RegExpWrapper.create('//|\\(|\\)|;|\\?|='); + function assertPath(path) { + if (lang_1.StringWrapper.contains(path, '#')) { + throw new exceptions_1.BaseException("Path \"" + path + "\" should not include \"#\". Use \"HashLocationStrategy\" instead."); + } + var illegalCharacter = lang_1.RegExpWrapper.firstMatch(RESERVED_CHARS, path); + if (lang_1.isPresent(illegalCharacter)) { + throw new exceptions_1.BaseException("Path \"" + path + "\" contains \"" + illegalCharacter[0] + "\" which is not allowed in a route config."); + } + } + var PathMatch = (function() { + function PathMatch(instruction, remaining, remainingAux) { + this.instruction = instruction; + this.remaining = remaining; + this.remainingAux = remainingAux; + } + return PathMatch; + })(); + exports.PathMatch = PathMatch; + var PathRecognizer = (function() { + function PathRecognizer(path, handler) { + this.path = path; + this.handler = handler; + this.terminal = true; + this._cache = new collection_1.Map(); + assertPath(path); + var parsed = parsePathString(path); + this._segments = parsed['segments']; + this.specificity = parsed['specificity']; + this.hash = pathDslHash(this._segments); + var lastSegment = this._segments[this._segments.length - 1]; + this.terminal = !(lastSegment instanceof ContinuationSegment); + } + PathRecognizer.prototype.recognize = function(beginningSegment) { + var nextSegment = beginningSegment; + var currentSegment; + var positionalParams = {}; + var captured = []; + for (var i = 0; i < this._segments.length; i += 1) { + var segment = this._segments[i]; + currentSegment = nextSegment; + if (segment instanceof ContinuationSegment) { + break; + } + if (lang_1.isPresent(currentSegment)) { + captured.push(currentSegment.path); + if (segment instanceof StarSegment) { + positionalParams[segment.name] = currentSegment.toString(); + nextSegment = null; + break; + } + if (segment instanceof DynamicSegment) { + positionalParams[segment.name] = currentSegment.path; + } else if (!segment.match(currentSegment.path)) { + return null; + } + nextSegment = currentSegment.child; + } else if (!segment.match('')) { + return null; + } + } + if (this.terminal && lang_1.isPresent(nextSegment)) { + return null; + } + var urlPath = captured.join('/'); + var auxiliary; + var instruction; + var urlParams; + var allParams; + if (lang_1.isPresent(currentSegment)) { + var paramsSegment = beginningSegment instanceof url_parser_1.RootUrl ? beginningSegment : currentSegment; + allParams = lang_1.isPresent(paramsSegment.params) ? collection_1.StringMapWrapper.merge(paramsSegment.params, positionalParams) : positionalParams; + urlParams = url_parser_1.serializeParams(paramsSegment.params); + auxiliary = currentSegment.auxiliary; + } else { + allParams = positionalParams; + auxiliary = []; + urlParams = []; + } + instruction = this._getInstruction(urlPath, urlParams, this, allParams); + return new PathMatch(instruction, nextSegment, auxiliary); + }; + PathRecognizer.prototype.generate = function(params) { + var paramTokens = new TouchMap(params); + var path = []; + for (var i = 0; i < this._segments.length; i++) { + var segment = this._segments[i]; + if (!(segment instanceof ContinuationSegment)) { + path.push(segment.generate(paramTokens)); + } + } + var urlPath = path.join('/'); + var nonPositionalParams = paramTokens.getUnused(); + var urlParams = url_parser_1.serializeParams(nonPositionalParams); + return this._getInstruction(urlPath, urlParams, this, params); + }; + PathRecognizer.prototype._getInstruction = function(urlPath, urlParams, _recognizer, params) { + var hashKey = urlPath + '?' + urlParams.join('?'); + if (this._cache.has(hashKey)) { + return this._cache.get(hashKey); + } + var instruction = new instruction_1.ComponentInstruction(urlPath, urlParams, _recognizer, params); + this._cache.set(hashKey, instruction); + return instruction; + }; + return PathRecognizer; + })(); + exports.PathRecognizer = PathRecognizer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_nomalizer", ["angular2/src/router/route_config_decorator", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var route_config_decorator_1 = require("angular2/src/router/route_config_decorator"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + function normalizeRouteConfig(config) { + if (config instanceof route_config_decorator_1.Route || config instanceof route_config_decorator_1.Redirect || config instanceof route_config_decorator_1.AsyncRoute || config instanceof route_config_decorator_1.AuxRoute) { + return config; + } + if ((!config.component) == (!config.redirectTo)) { + throw new exceptions_1.BaseException("Route config should contain exactly one \"component\", \"loader\", or \"redirectTo\" property."); + } + if (config.component) { + if (typeof config.component == 'object') { + var componentDefinitionObject = config.component; + if (componentDefinitionObject.type == 'constructor') { + return new route_config_decorator_1.Route({ + path: config.path, + component: componentDefinitionObject.constructor, + as: config.as + }); + } else if (componentDefinitionObject.type == 'loader') { + return new route_config_decorator_1.AsyncRoute({ + path: config.path, + loader: componentDefinitionObject.loader, + as: config.as + }); + } else { + throw new exceptions_1.BaseException("Invalid component type \"" + componentDefinitionObject.type + "\". Valid types are \"constructor\" and \"loader\"."); + } + } + return new route_config_decorator_1.Route(config); + } + if (config.redirectTo) { + return new route_config_decorator_1.Redirect({ + path: config.path, + redirectTo: config.redirectTo + }); + } + return config; + } + exports.normalizeRouteConfig = normalizeRouteConfig; + function assertComponentExists(component, path) { + if (!lang_1.isType(component)) { + throw new exceptions_1.BaseException("Component for route \"" + path + "\" is not defined, or is not a class."); + } + } + exports.assertComponentExists = assertComponentExists; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/core/facade/exceptions", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var URLSearchParams_UnionFixer = url_search_params_1.URLSearchParamsUnionFixer; + var ConnectionBackend = (function() { + function ConnectionBackend() {} + ConnectionBackend.prototype.createConnection = function(request) { + throw new exceptions_1.BaseException('Abstract!'); + }; + return ConnectionBackend; + })(); + exports.ConnectionBackend = ConnectionBackend; + var Connection = (function() { + function Connection() {} + Connection.prototype.dispose = function() { + throw new exceptions_1.BaseException('Abstract!'); + }; + return Connection; + })(); + exports.Connection = Connection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var headers_1 = require("angular2/src/http/headers"); + var lang_1 = require("angular2/src/core/facade/lang"); + var Request = (function() { + function Request(requestOptions) { + var url = requestOptions.url; + this.url = requestOptions.url; + if (lang_1.isPresent(requestOptions.search)) { + var search = requestOptions.search.toString(); + if (search.length > 0) { + var prefix = '?'; + if (lang_1.StringWrapper.contains(this.url, '?')) { + prefix = (this.url[this.url.length - 1] == '&') ? '' : '&'; + } + this.url = url + prefix + search; + } + } + this._body = requestOptions.body; + this.method = requestOptions.method; + this.headers = new headers_1.Headers(requestOptions.headers); + } + Request.prototype.text = function() { + return lang_1.isPresent(this._body) ? this._body.toString() : ''; + }; + return Request; + })(); + exports.Request = Request; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/core/di", "angular2/src/http/url_search_params"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var di_1 = require("angular2/src/core/di"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var RequestOptions = (function() { + function RequestOptions(_a) { + var _b = _a === void 0 ? {} : _a, + method = _b.method, + headers = _b.headers, + body = _b.body, + url = _b.url, + search = _b.search; + this.method = lang_1.isPresent(method) ? method : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.body = lang_1.isPresent(body) ? body : null; + this.url = lang_1.isPresent(url) ? url : null; + this.search = lang_1.isPresent(search) ? (lang_1.isString(search) ? new url_search_params_1.URLSearchParams((search)) : (search)) : null; + } + RequestOptions.prototype.merge = function(options) { + return new RequestOptions({ + method: lang_1.isPresent(options) && lang_1.isPresent(options.method) ? options.method : this.method, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url, + search: lang_1.isPresent(options) && lang_1.isPresent(options.search) ? (lang_1.isString(options.search) ? new url_search_params_1.URLSearchParams((options.search)) : (options.search).clone()) : this.search + }); + }; + return RequestOptions; + })(); + exports.RequestOptions = RequestOptions; + var BaseRequestOptions = (function(_super) { + __extends(BaseRequestOptions, _super); + function BaseRequestOptions() { + _super.call(this, { + method: enums_1.RequestMethods.Get, + headers: new headers_1.Headers() + }); + } + BaseRequestOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions); + return BaseRequestOptions; + })(RequestOptions); + exports.BaseRequestOptions = BaseRequestOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/http/http_utils"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var http_utils_1 = require("angular2/src/http/http_utils"); + var Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + Response.prototype.blob = function() { + throw new exceptions_1.BaseException('"blob()" method not implemented on Response superclass'); + }; + Response.prototype.json = function() { + var jsonResponse; + if (http_utils_1.isJsObject(this._body)) { + jsonResponse = this._body; + } else if (lang_1.isString(this._body)) { + jsonResponse = lang_1.Json.parse(this._body); + } + return jsonResponse; + }; + Response.prototype.text = function() { + return this._body.toString(); + }; + Response.prototype.arrayBuffer = function() { + throw new exceptions_1.BaseException('"arrayBuffer()" method not implemented on Response superclass'); + }; + return Response; + })(); + exports.Response = Response; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var async_1 = require("angular2/src/core/facade/async"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var _this = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== enums_1.RequestMethods.Get) { + throw exceptions_1.makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Loading; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = lang_1.StringWrapper.replace(url, '=JSONP_CALLBACK&', "=" + callback + "&"); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = lang_1.StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', function(event) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + if (!_this._finished) { + async_1.ObservableWrapper.callThrow(_this.response, exceptions_1.makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new base_response_options_1.ResponseOptions({body: _this._responseData}); + if (lang_1.isPresent(_this.baseResponseOptions)) { + responseOptions = _this.baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + }); + script.addEventListener('error', function(error) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + async_1.ObservableWrapper.callThrow(_this.response, error); + }); + _dom.send(script); + } + JSONPConnection.prototype.finished = function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === enums_1.ReadyStates.Cancelled) + return ; + this._responseData = data; + }; + JSONPConnection.prototype.dispose = function() { + this.readyState = enums_1.ReadyStates.Cancelled; + var script = this._script; + this._script = null; + if (lang_1.isPresent(script)) { + this._dom.cleanup(script); + } + async_1.ObservableWrapper.callReturn(this.response); + }; + return JSONPConnection; + })(); + exports.JSONPConnection = JSONPConnection; + var JSONPBackend = (function() { + function JSONPBackend(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + } + JSONPBackend.prototype.createConnection = function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }; + JSONPBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_jsonp_1.BrowserJsonp, base_response_options_1.ResponseOptions])], JSONPBackend); + return JSONPBackend; + })(); + exports.JSONPBackend = JSONPBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/router/instruction", "angular2/src/router/route_lifecycle_reflector"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var instruction_1 = require("angular2/src/router/instruction"); + var route_lifecycle_reflector_1 = require("angular2/src/router/route_lifecycle_reflector"); + var _resolveToTrue = async_1.PromiseWrapper.resolve(true); + var _resolveToFalse = async_1.PromiseWrapper.resolve(false); + var Router = (function() { + function Router(registry, parent, hostComponent) { + this.registry = registry; + this.parent = parent; + this.hostComponent = hostComponent; + this.navigating = false; + this._currentInstruction = null; + this._currentNavigation = _resolveToTrue; + this._outlet = null; + this._auxRouters = new collection_1.Map(); + this._subject = new async_1.EventEmitter(); + } + Router.prototype.childRouter = function(hostComponent) { + return this._childRouter = new ChildRouter(this, hostComponent); + }; + Router.prototype.auxRouter = function(hostComponent) { + return new ChildRouter(this, hostComponent); + }; + Router.prototype.registerPrimaryOutlet = function(outlet) { + if (lang_1.isPresent(outlet.name)) { + throw new exceptions_1.BaseException("registerAuxOutlet expects to be called with an unnamed outlet."); + } + this._outlet = outlet; + if (lang_1.isPresent(this._currentInstruction)) { + return this.commit(this._currentInstruction, false); + } + return _resolveToTrue; + }; + Router.prototype.registerAuxOutlet = function(outlet) { + var outletName = outlet.name; + if (lang_1.isBlank(outletName)) { + throw new exceptions_1.BaseException("registerAuxOutlet expects to be called with an outlet with a name."); + } + var router = this.auxRouter(this.hostComponent); + this._auxRouters.set(outletName, router); + router._outlet = outlet; + var auxInstruction; + if (lang_1.isPresent(this._currentInstruction) && lang_1.isPresent(auxInstruction = this._currentInstruction.auxInstruction[outletName])) { + return router.commit(auxInstruction); + } + return _resolveToTrue; + }; + Router.prototype.isRouteActive = function(instruction) { + var router = this; + while (lang_1.isPresent(router.parent) && lang_1.isPresent(instruction.child)) { + router = router.parent; + instruction = instruction.child; + } + return lang_1.isPresent(this._currentInstruction) && this._currentInstruction.component == instruction.component; + }; + Router.prototype.config = function(definitions) { + var _this = this; + definitions.forEach(function(routeDefinition) { + _this.registry.config(_this.hostComponent, routeDefinition); + }); + return this.renavigate(); + }; + Router.prototype.navigate = function(linkParams) { + var instruction = this.generate(linkParams); + return this.navigateByInstruction(instruction, false); + }; + Router.prototype.navigateByUrl = function(url, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this._currentNavigation = this._currentNavigation.then(function(_) { + _this.lastNavigationAttempt = url; + _this._startNavigating(); + return _this._afterPromiseFinishNavigating(_this.recognize(url).then(function(instruction) { + if (lang_1.isBlank(instruction)) { + return false; + } + return _this._navigate(instruction, _skipLocationChange); + })); + }); + }; + Router.prototype.navigateByInstruction = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + if (lang_1.isBlank(instruction)) { + return _resolveToFalse; + } + return this._currentNavigation = this._currentNavigation.then(function(_) { + _this._startNavigating(); + return _this._afterPromiseFinishNavigating(_this._navigate(instruction, _skipLocationChange)); + }); + }; + Router.prototype._navigate = function(instruction, _skipLocationChange) { + var _this = this; + return this._settleInstruction(instruction).then(function(_) { + return _this._canReuse(instruction); + }).then(function(_) { + return _this._canActivate(instruction); + }).then(function(result) { + if (!result) { + return false; + } + return _this._canDeactivate(instruction).then(function(result) { + if (result) { + return _this.commit(instruction, _skipLocationChange).then(function(_) { + _this._emitNavigationFinish(instruction_1.stringifyInstruction(instruction)); + return true; + }); + } + }); + }); + }; + Router.prototype._settleInstruction = function(instruction) { + var _this = this; + var unsettledInstructions = []; + if (lang_1.isBlank(instruction.component.componentType)) { + unsettledInstructions.push(instruction.component.resolveComponentType().then(function(type) { + _this.registry.configFromComponent(type); + })); + } + if (lang_1.isPresent(instruction.child)) { + unsettledInstructions.push(this._settleInstruction(instruction.child)); + } + collection_1.StringMapWrapper.forEach(instruction.auxInstruction, function(instruction, _) { + unsettledInstructions.push(_this._settleInstruction(instruction)); + }); + return async_1.PromiseWrapper.all(unsettledInstructions); + }; + Router.prototype._emitNavigationFinish = function(url) { + async_1.ObservableWrapper.callNext(this._subject, url); + }; + Router.prototype._afterPromiseFinishNavigating = function(promise) { + var _this = this; + return async_1.PromiseWrapper.catchError(promise.then(function(_) { + return _this._finishNavigating(); + }), function(err) { + _this._finishNavigating(); + throw err; + }); + }; + Router.prototype._canReuse = function(instruction) { + var _this = this; + if (lang_1.isBlank(this._outlet)) { + return _resolveToFalse; + } + return this._outlet.canReuse(instruction.component).then(function(result) { + instruction.component.reuse = result; + if (result && lang_1.isPresent(_this._childRouter) && lang_1.isPresent(instruction.child)) { + return _this._childRouter._canReuse(instruction.child); + } + }); + }; + Router.prototype._canActivate = function(nextInstruction) { + return canActivateOne(nextInstruction, this._currentInstruction); + }; + Router.prototype._canDeactivate = function(instruction) { + var _this = this; + if (lang_1.isBlank(this._outlet)) { + return _resolveToTrue; + } + var next; + var childInstruction = null; + var reuse = false; + var componentInstruction = null; + if (lang_1.isPresent(instruction)) { + childInstruction = instruction.child; + componentInstruction = instruction.component; + reuse = instruction.component.reuse; + } + if (reuse) { + next = _resolveToTrue; + } else { + next = this._outlet.canDeactivate(componentInstruction); + } + return next.then(function(result) { + if (result == false) { + return false; + } + if (lang_1.isPresent(_this._childRouter)) { + return _this._childRouter._canDeactivate(childInstruction); + } + return true; + }); + }; + Router.prototype.commit = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + this._currentInstruction = instruction; + var next = _resolveToTrue; + if (lang_1.isPresent(this._outlet)) { + var componentInstruction = instruction.component; + if (componentInstruction.reuse) { + next = this._outlet.reuse(componentInstruction); + } else { + next = this.deactivate(instruction).then(function(_) { + return _this._outlet.activate(componentInstruction); + }); + } + if (lang_1.isPresent(instruction.child)) { + next = next.then(function(_) { + if (lang_1.isPresent(_this._childRouter)) { + return _this._childRouter.commit(instruction.child); + } + }); + } + } + var promises = []; + collection_1.MapWrapper.forEach(this._auxRouters, function(router, name) { + promises.push(router.commit(instruction.auxInstruction[name])); + }); + return next.then(function(_) { + return async_1.PromiseWrapper.all(promises); + }); + }; + Router.prototype._startNavigating = function() { + this.navigating = true; + }; + Router.prototype._finishNavigating = function() { + this.navigating = false; + }; + Router.prototype.subscribe = function(onNext) { + return async_1.ObservableWrapper.subscribe(this._subject, onNext); + }; + Router.prototype.deactivate = function(instruction) { + var _this = this; + var childInstruction = null; + var componentInstruction = null; + if (lang_1.isPresent(instruction)) { + childInstruction = instruction.child; + componentInstruction = instruction.component; + } + var next = _resolveToTrue; + if (lang_1.isPresent(this._childRouter)) { + next = this._childRouter.deactivate(childInstruction); + } + if (lang_1.isPresent(this._outlet)) { + next = next.then(function(_) { + return _this._outlet.deactivate(componentInstruction); + }); + } + return next; + }; + Router.prototype.recognize = function(url) { + return this.registry.recognize(url, this.hostComponent); + }; + Router.prototype.renavigate = function() { + if (lang_1.isBlank(this.lastNavigationAttempt)) { + return this._currentNavigation; + } + return this.navigateByUrl(this.lastNavigationAttempt); + }; + Router.prototype.generate = function(linkParams) { + var normalizedLinkParams = splitAndFlattenLinkParams(linkParams); + var first = collection_1.ListWrapper.first(normalizedLinkParams); + var rest = collection_1.ListWrapper.slice(normalizedLinkParams, 1); + var router = this; + if (first == '') { + while (lang_1.isPresent(router.parent)) { + router = router.parent; + } + } else if (first == '..') { + router = router.parent; + while (collection_1.ListWrapper.first(rest) == '..') { + rest = collection_1.ListWrapper.slice(rest, 1); + router = router.parent; + if (lang_1.isBlank(router)) { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" has too many \"../\" segments."); + } + } + } else if (first != '.') { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" must start with \"/\", \"./\", or \"../\""); + } + if (rest[rest.length - 1] == '') { + collection_1.ListWrapper.removeLast(rest); + } + if (rest.length < 1) { + var msg = "Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" must include a route name."; + throw new exceptions_1.BaseException(msg); + } + var url = []; + var parent = router.parent; + while (lang_1.isPresent(parent)) { + url.unshift(parent._currentInstruction); + parent = parent.parent; + } + var nextInstruction = this.registry.generate(rest, router.hostComponent); + while (url.length > 0) { + nextInstruction = url.pop().replaceChild(nextInstruction); + } + return nextInstruction; + }; + return Router; + })(); + exports.Router = Router; + var RootRouter = (function(_super) { + __extends(RootRouter, _super); + function RootRouter(registry, location, primaryComponent) { + var _this = this; + _super.call(this, registry, null, primaryComponent); + this._location = location; + this._location.subscribe(function(change) { + return _this.navigateByUrl(change['url'], lang_1.isPresent(change['pop'])); + }); + this.registry.configFromComponent(primaryComponent); + this.navigateByUrl(location.path()); + } + RootRouter.prototype.commit = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + var emitUrl = instruction_1.stringifyInstruction(instruction); + if (emitUrl.length > 0) { + emitUrl = '/' + emitUrl; + } + var promise = _super.prototype.commit.call(this, instruction); + if (!_skipLocationChange) { + promise = promise.then(function(_) { + _this._location.go(emitUrl); + }); + } + return promise; + }; + return RootRouter; + })(Router); + exports.RootRouter = RootRouter; + var ChildRouter = (function(_super) { + __extends(ChildRouter, _super); + function ChildRouter(parent, hostComponent) { + _super.call(this, parent.registry, parent, hostComponent); + this.parent = parent; + } + ChildRouter.prototype.navigateByUrl = function(url, _skipLocationChange) { + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this.parent.navigateByUrl(url, _skipLocationChange); + }; + ChildRouter.prototype.navigateByInstruction = function(instruction, _skipLocationChange) { + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this.parent.navigateByInstruction(instruction, _skipLocationChange); + }; + return ChildRouter; + })(Router); + var SLASH = new RegExp('/'); + function splitAndFlattenLinkParams(linkParams) { + return collection_1.ListWrapper.reduce(linkParams, function(accumulation, item) { + if (lang_1.isString(item)) { + return accumulation.concat(lang_1.StringWrapper.split(item, SLASH)); + } + accumulation.push(item); + return accumulation; + }, []); + } + function canActivateOne(nextInstruction, prevInstruction) { + var next = _resolveToTrue; + if (lang_1.isPresent(nextInstruction.child)) { + next = canActivateOne(nextInstruction.child, lang_1.isPresent(prevInstruction) ? prevInstruction.child : null); + } + return next.then(function(result) { + if (result == false) { + return false; + } + if (nextInstruction.component.reuse) { + return true; + } + var hook = route_lifecycle_reflector_1.getCanActivateHook(nextInstruction.component.componentType); + if (lang_1.isPresent(hook)) { + return hook(nextInstruction.component, lang_1.isPresent(prevInstruction) ? prevInstruction.component : null); + } + return true; + }); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router_link", ["angular2/src/core/metadata", "angular2/src/router/router", "angular2/src/router/location", "angular2/src/router/instruction"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var router_1 = require("angular2/src/router/router"); + var location_1 = require("angular2/src/router/location"); + var instruction_1 = require("angular2/src/router/instruction"); + var RouterLink = (function() { + function RouterLink(_router, _location) { + this._router = _router; + this._location = _location; + } + Object.defineProperty(RouterLink.prototype, "isRouteActive", { + get: function() { + return this._router.isRouteActive(this._navigationInstruction); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RouterLink.prototype, "routeParams", { + set: function(changes) { + this._routeParams = changes; + this._navigationInstruction = this._router.generate(this._routeParams); + var navigationHref = '/' + instruction_1.stringifyInstruction(this._navigationInstruction); + this.visibleHref = this._location.normalizeAbsolutely(navigationHref); + }, + enumerable: true, + configurable: true + }); + RouterLink.prototype.onClick = function() { + this._router.navigateByInstruction(this._navigationInstruction); + return false; + }; + RouterLink = __decorate([metadata_1.Directive({ + selector: '[router-link]', + properties: ['routeParams: routerLink'], + host: { + '(click)': 'onClick()', + '[attr.href]': 'visibleHref', + '[class.router-link-active]': 'isRouteActive' + } + }), __metadata('design:paramtypes', [router_1.Router, location_1.Location])], RouterLink); + return RouterLink; + })(); + exports.RouterLink = RouterLink; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_recognizer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/route_config_impl", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler", "angular2/src/router/url_parser"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var path_recognizer_1 = require("angular2/src/router/path_recognizer"); + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var async_route_handler_1 = require("angular2/src/router/async_route_handler"); + var sync_route_handler_1 = require("angular2/src/router/sync_route_handler"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var RouteRecognizer = (function() { + function RouteRecognizer() { + this.names = new collection_1.Map(); + this.auxRoutes = new collection_1.Map(); + this.matchers = []; + this.redirects = []; + } + RouteRecognizer.prototype.config = function(config) { + var handler; + if (lang_1.isPresent(config.as) && config.as[0].toUpperCase() != config.as[0]) { + var suggestedAlias = config.as[0].toUpperCase() + config.as.substring(1); + throw new exceptions_1.BaseException("Route '" + config.path + "' with alias '" + config.as + "' does not begin with an uppercase letter. Route aliases should be CamelCase like '" + suggestedAlias + "'."); + } + if (config instanceof route_config_impl_1.AuxRoute) { + handler = new sync_route_handler_1.SyncRouteHandler(config.component, config.data); + var path = lang_1.StringWrapper.startsWith(config.path, '/') ? config.path.substring(1) : config.path; + var recognizer = new path_recognizer_1.PathRecognizer(config.path, handler); + this.auxRoutes.set(path, recognizer); + return recognizer.terminal; + } + if (config instanceof route_config_impl_1.Redirect) { + this.redirects.push(new Redirector(config.path, config.redirectTo)); + return true; + } + if (config instanceof route_config_impl_1.Route) { + handler = new sync_route_handler_1.SyncRouteHandler(config.component, config.data); + } else if (config instanceof route_config_impl_1.AsyncRoute) { + handler = new async_route_handler_1.AsyncRouteHandler(config.loader, config.data); + } + var recognizer = new path_recognizer_1.PathRecognizer(config.path, handler); + this.matchers.forEach(function(matcher) { + if (recognizer.hash == matcher.hash) { + throw new exceptions_1.BaseException("Configuration '" + config.path + "' conflicts with existing route '" + matcher.path + "'"); + } + }); + this.matchers.push(recognizer); + if (lang_1.isPresent(config.as)) { + this.names.set(config.as, recognizer); + } + return recognizer.terminal; + }; + RouteRecognizer.prototype.recognize = function(urlParse) { + var solutions = []; + urlParse = this._redirect(urlParse); + this.matchers.forEach(function(pathRecognizer) { + var pathMatch = pathRecognizer.recognize(urlParse); + if (lang_1.isPresent(pathMatch)) { + solutions.push(pathMatch); + } + }); + return solutions; + }; + RouteRecognizer.prototype._redirect = function(urlParse) { + for (var i = 0; i < this.redirects.length; i += 1) { + var redirector = this.redirects[i]; + var redirectedUrl = redirector.redirect(urlParse); + if (lang_1.isPresent(redirectedUrl)) { + return redirectedUrl; + } + } + return urlParse; + }; + RouteRecognizer.prototype.recognizeAuxiliary = function(urlParse) { + var pathRecognizer = this.auxRoutes.get(urlParse.path); + if (lang_1.isBlank(pathRecognizer)) { + return null; + } + return pathRecognizer.recognize(urlParse); + }; + RouteRecognizer.prototype.hasRoute = function(name) { + return this.names.has(name); + }; + RouteRecognizer.prototype.generate = function(name, params) { + var pathRecognizer = this.names.get(name); + if (lang_1.isBlank(pathRecognizer)) { + return null; + } + return pathRecognizer.generate(params); + }; + return RouteRecognizer; + })(); + exports.RouteRecognizer = RouteRecognizer; + var Redirector = (function() { + function Redirector(path, redirectTo) { + this.segments = []; + this.toSegments = []; + if (lang_1.StringWrapper.startsWith(path, '/')) { + path = path.substring(1); + } + this.segments = path.split('/'); + if (lang_1.StringWrapper.startsWith(redirectTo, '/')) { + redirectTo = redirectTo.substring(1); + } + this.toSegments = redirectTo.split('/'); + } + Redirector.prototype.redirect = function(urlParse) { + for (var i = 0; i < this.segments.length; i += 1) { + if (lang_1.isBlank(urlParse)) { + return null; + } + var segment = this.segments[i]; + if (segment != urlParse.path) { + return null; + } + urlParse = urlParse.child; + } + for (var i = this.toSegments.length - 1; i >= 0; i -= 1) { + var segment = this.toSegments[i]; + urlParse = new url_parser_1.Url(segment, urlParse); + } + return urlParse; + }; + return Redirector; + })(); + exports.Redirector = Redirector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var decorators_1 = require("angular2/src/core/di/decorators"); + var interfaces_1 = require("angular2/src/http/interfaces"); + var static_request_1 = require("angular2/src/http/static_request"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var enums_1 = require("angular2/src/http/enums"); + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (lang_1.isPresent(providedOpts)) { + newOptions = newOptions.merge(new base_request_options_1.RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + search: providedOpts.search, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (lang_1.isPresent(method)) { + return newOptions.merge(new base_request_options_1.RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new base_request_options_1.RequestOptions({url: url})); + } + } + var Http = (function() { + function Http(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + } + Http.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + responseObservable = httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + } else if (url instanceof static_request_1.Request) { + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Http.prototype.get = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + }; + Http.prototype.post = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Post, url))); + }; + Http.prototype.put = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Put, url))); + }; + Http.prototype.delete = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Delete, url))); + }; + Http.prototype.patch = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Patch, url))); + }; + Http.prototype.head = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Head, url))); + }; + Http = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Http); + return Http; + })(); + exports.Http = Http; + var Jsonp = (function(_super) { + __extends(Jsonp, _super); + function Jsonp(backend, defaultOptions) { + _super.call(this, backend, defaultOptions); + } + Jsonp.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + url = new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url)); + } + if (url instanceof static_request_1.Request) { + if (url.method !== enums_1.RequestMethods.Get) { + exceptions_1.makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Jsonp = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Jsonp); + return Jsonp; + })(Http); + exports.Jsonp = Jsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_xhr", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var _this = this; + this.request = req; + this.response = new async_1.EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(enums_1.RequestMethods[req.method].toUpperCase(), req.url); + this._xhr.addEventListener('load', function(_) { + var response = lang_1.isPresent(_this._xhr.response) ? _this._xhr.response : _this._xhr.responseText; + var status = _this._xhr.status === 1223 ? 204 : _this._xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + var responseOptions = new base_response_options_1.ResponseOptions({ + body: response, + status: status + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + async_1.ObservableWrapper.callReturn(_this.response); + }); + this._xhr.addEventListener('error', function(err) { + var responseOptions = new base_response_options_1.ResponseOptions({ + body: err, + type: enums_1.ResponseTypes.Error + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callThrow(_this.response, new static_response_1.Response(responseOptions)); + }); + if (lang_1.isPresent(req.headers)) { + req.headers.forEach(function(value, name) { + _this._xhr.setRequestHeader(name, value); + }); + } + this._xhr.send(this.request.text()); + } + XHRConnection.prototype.dispose = function() { + this._xhr.abort(); + }; + return XHRConnection; + })(); + exports.XHRConnection = XHRConnection; + var XHRBackend = (function() { + function XHRBackend(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + } + XHRBackend.prototype.createConnection = function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }; + XHRBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_xhr_1.BrowserXhr, base_response_options_1.ResponseOptions])], XHRBackend); + return XHRBackend; + })(); + exports.XHRBackend = XHRBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/router/route_config_impl", "angular2/src/core/reflection/reflection", "angular2/src/core/di", "angular2/src/router/route_config_nomalizer", "angular2/src/router/url_parser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var route_recognizer_1 = require("angular2/src/router/route_recognizer"); + var instruction_1 = require("angular2/src/router/instruction"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_1 = require("angular2/src/core/di"); + var route_config_nomalizer_1 = require("angular2/src/router/route_config_nomalizer"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var _resolveToNull = async_1.PromiseWrapper.resolve(null); + var RouteRegistry = (function() { + function RouteRegistry() { + this._rules = new collection_1.Map(); + } + RouteRegistry.prototype.config = function(parentComponent, config) { + config = route_config_nomalizer_1.normalizeRouteConfig(config); + if (config instanceof route_config_impl_1.Route) { + route_config_nomalizer_1.assertComponentExists(config.component, config.path); + } else if (config instanceof route_config_impl_1.AuxRoute) { + route_config_nomalizer_1.assertComponentExists(config.component, config.path); + } + var recognizer = this._rules.get(parentComponent); + if (lang_1.isBlank(recognizer)) { + recognizer = new route_recognizer_1.RouteRecognizer(); + this._rules.set(parentComponent, recognizer); + } + var terminal = recognizer.config(config); + if (config instanceof route_config_impl_1.Route) { + if (terminal) { + assertTerminalComponent(config.component, config.path); + } else { + this.configFromComponent(config.component); + } + } + }; + RouteRegistry.prototype.configFromComponent = function(component) { + var _this = this; + if (!lang_1.isType(component)) { + return ; + } + if (this._rules.has(component)) { + return ; + } + var annotations = reflection_1.reflector.annotations(component); + if (lang_1.isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof route_config_impl_1.RouteConfig) { + collection_1.ListWrapper.forEach(annotation.configs, function(config) { + return _this.config(component, config); + }); + } + } + } + }; + RouteRegistry.prototype.recognize = function(url, parentComponent) { + var parsedUrl = url_parser_1.parser.parse(url); + return this._recognize(parsedUrl, parentComponent); + }; + RouteRegistry.prototype._recognize = function(parsedUrl, parentComponent) { + var _this = this; + return this._recognizePrimaryRoute(parsedUrl, parentComponent).then(function(instruction) { + return _this._completeAuxiliaryRouteMatches(instruction, parentComponent); + }); + }; + RouteRegistry.prototype._recognizePrimaryRoute = function(parsedUrl, parentComponent) { + var _this = this; + var componentRecognizer = this._rules.get(parentComponent); + if (lang_1.isBlank(componentRecognizer)) { + return _resolveToNull; + } + var possibleMatches = componentRecognizer.recognize(parsedUrl); + var matchPromises = collection_1.ListWrapper.map(possibleMatches, function(candidate) { + return _this._completePrimaryRouteMatch(candidate); + }); + return async_1.PromiseWrapper.all(matchPromises).then(mostSpecific); + }; + RouteRegistry.prototype._completePrimaryRouteMatch = function(partialMatch) { + var _this = this; + var instruction = partialMatch.instruction; + return instruction.resolveComponentType().then(function(componentType) { + _this.configFromComponent(componentType); + if (instruction.terminal) { + return new instruction_1.PrimaryInstruction(instruction, null, partialMatch.remainingAux); + } + return _this._recognizePrimaryRoute(partialMatch.remaining, componentType).then(function(childInstruction) { + if (lang_1.isBlank(childInstruction)) { + return null; + } else { + return new instruction_1.PrimaryInstruction(instruction, childInstruction, partialMatch.remainingAux); + } + }); + }); + }; + RouteRegistry.prototype._completeAuxiliaryRouteMatches = function(instruction, parentComponent) { + var _this = this; + if (lang_1.isBlank(instruction)) { + return _resolveToNull; + } + var componentRecognizer = this._rules.get(parentComponent); + var auxInstructions = {}; + var promises = instruction.auxUrls.map(function(auxSegment) { + var match = componentRecognizer.recognizeAuxiliary(auxSegment); + if (lang_1.isBlank(match)) { + return _resolveToNull; + } + return _this._completePrimaryRouteMatch(match).then(function(auxInstruction) { + if (lang_1.isPresent(auxInstruction)) { + return _this._completeAuxiliaryRouteMatches(auxInstruction, parentComponent).then(function(finishedAuxRoute) { + auxInstructions[auxSegment.path] = finishedAuxRoute; + }); + } + }); + }); + return async_1.PromiseWrapper.all(promises).then(function(_) { + if (lang_1.isBlank(instruction.child)) { + return new instruction_1.Instruction(instruction.component, null, auxInstructions); + } + return _this._completeAuxiliaryRouteMatches(instruction.child, instruction.component.componentType).then(function(completeChild) { + return new instruction_1.Instruction(instruction.component, completeChild, auxInstructions); + }); + }); + }; + RouteRegistry.prototype.generate = function(linkParams, parentComponent) { + var segments = []; + var componentCursor = parentComponent; + var lastInstructionIsTerminal = false; + for (var i = 0; i < linkParams.length; i += 1) { + var segment = linkParams[i]; + if (lang_1.isBlank(componentCursor)) { + throw new exceptions_1.BaseException("Could not find route named \"" + segment + "\"."); + } + if (!lang_1.isString(segment)) { + throw new exceptions_1.BaseException("Unexpected segment \"" + segment + "\" in link DSL. Expected a string."); + } else if (segment == '' || segment == '.' || segment == '..') { + throw new exceptions_1.BaseException("\"" + segment + "/\" is only allowed at the beginning of a link DSL."); + } + var params = {}; + if (i + 1 < linkParams.length) { + var nextSegment = linkParams[i + 1]; + if (lang_1.isStringMap(nextSegment)) { + params = nextSegment; + i += 1; + } + } + var componentRecognizer = this._rules.get(componentCursor); + if (lang_1.isBlank(componentRecognizer)) { + throw new exceptions_1.BaseException("Component \"" + lang_1.getTypeNameForDebugging(componentCursor) + "\" has no route config."); + } + var response = componentRecognizer.generate(segment, params); + if (lang_1.isBlank(response)) { + throw new exceptions_1.BaseException("Component \"" + lang_1.getTypeNameForDebugging(componentCursor) + "\" has no route named \"" + segment + "\"."); + } + segments.push(response); + componentCursor = response.componentType; + lastInstructionIsTerminal = response.terminal; + } + var instruction = null; + if (!lastInstructionIsTerminal) { + instruction = this._generateRedirects(componentCursor); + if (lang_1.isPresent(instruction)) { + var lastInstruction = instruction; + while (lang_1.isPresent(lastInstruction.child)) { + lastInstruction = lastInstruction.child; + } + lastInstructionIsTerminal = lastInstruction.component.terminal; + } + if (lang_1.isPresent(componentCursor) && !lastInstructionIsTerminal) { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" does not resolve to a terminal or async instruction."); + } + } + while (segments.length > 0) { + instruction = new instruction_1.Instruction(segments.pop(), instruction, {}); + } + return instruction; + }; + RouteRegistry.prototype._generateRedirects = function(componentCursor) { + if (lang_1.isBlank(componentCursor)) { + return null; + } + var componentRecognizer = this._rules.get(componentCursor); + if (lang_1.isBlank(componentRecognizer)) { + return null; + } + for (var i = 0; i < componentRecognizer.redirects.length; i += 1) { + var redirect = componentRecognizer.redirects[i]; + if (redirect.segments.length == 1 && redirect.segments[0] == '') { + var toSegments = url_parser_1.pathSegmentsToUrl(redirect.toSegments); + var matches = componentRecognizer.recognize(toSegments); + var primaryInstruction = collection_1.ListWrapper.maximum(matches, function(match) { + return match.instruction.specificity; + }); + if (lang_1.isPresent(primaryInstruction)) { + var child = this._generateRedirects(primaryInstruction.instruction.componentType); + return new instruction_1.Instruction(primaryInstruction.instruction, child, {}); + } + return null; + } + } + return null; + }; + RouteRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], RouteRegistry); + return RouteRegistry; + })(); + exports.RouteRegistry = RouteRegistry; + function mostSpecific(instructions) { + return collection_1.ListWrapper.maximum(instructions, function(instruction) { + return instruction.component.specificity; + }); + } + function assertTerminalComponent(component, path) { + if (!lang_1.isType(component)) { + return ; + } + var annotations = reflection_1.reflector.annotations(component); + if (lang_1.isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof route_config_impl_1.RouteConfig) { + throw new exceptions_1.BaseException("Child routes are not allowed for \"" + path + "\". Use \"...\" on the parent's route path."); + } + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/http", ["angular2/core", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/interfaces", "angular2/src/http/backends/browser_xhr", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/http", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var core_1 = require("angular2/core"); + var http_1 = require("angular2/src/http/http"); + var xhr_backend_1 = require("angular2/src/http/backends/xhr_backend"); + var jsonp_backend_1 = require("angular2/src/http/backends/jsonp_backend"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var mock_backend_1 = require("angular2/src/http/backends/mock_backend"); + exports.MockConnection = mock_backend_1.MockConnection; + exports.MockBackend = mock_backend_1.MockBackend; + var static_request_1 = require("angular2/src/http/static_request"); + exports.Request = static_request_1.Request; + var static_response_1 = require("angular2/src/http/static_response"); + exports.Response = static_response_1.Response; + var interfaces_1 = require("angular2/src/http/interfaces"); + exports.Connection = interfaces_1.Connection; + exports.ConnectionBackend = interfaces_1.ConnectionBackend; + var browser_xhr_2 = require("angular2/src/http/backends/browser_xhr"); + exports.BrowserXhr = browser_xhr_2.BrowserXhr; + var base_request_options_2 = require("angular2/src/http/base_request_options"); + exports.BaseRequestOptions = base_request_options_2.BaseRequestOptions; + exports.RequestOptions = base_request_options_2.RequestOptions; + var base_response_options_2 = require("angular2/src/http/base_response_options"); + exports.BaseResponseOptions = base_response_options_2.BaseResponseOptions; + exports.ResponseOptions = base_response_options_2.ResponseOptions; + var xhr_backend_2 = require("angular2/src/http/backends/xhr_backend"); + exports.XHRBackend = xhr_backend_2.XHRBackend; + exports.XHRConnection = xhr_backend_2.XHRConnection; + var jsonp_backend_2 = require("angular2/src/http/backends/jsonp_backend"); + exports.JSONPBackend = jsonp_backend_2.JSONPBackend; + exports.JSONPConnection = jsonp_backend_2.JSONPConnection; + var http_2 = require("angular2/src/http/http"); + exports.Http = http_2.Http; + exports.Jsonp = http_2.Jsonp; + var headers_1 = require("angular2/src/http/headers"); + exports.Headers = headers_1.Headers; + var enums_1 = require("angular2/src/http/enums"); + exports.ResponseTypes = enums_1.ResponseTypes; + exports.ReadyStates = enums_1.ReadyStates; + exports.RequestMethods = enums_1.RequestMethods; + var url_search_params_1 = require("angular2/src/http/url_search_params"); + exports.URLSearchParams = url_search_params_1.URLSearchParams; + exports.HTTP_BINDINGS = [core_1.bind(http_1.Http).toFactory(function(xhrBackend, requestOptions) { + return new http_1.Http(xhrBackend, requestOptions); + }, [xhr_backend_1.XHRBackend, base_request_options_1.RequestOptions]), browser_xhr_1.BrowserXhr, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), xhr_backend_1.XHRBackend]; + exports.JSONP_BINDINGS = [core_1.bind(http_1.Jsonp).toFactory(function(jsonpBackend, requestOptions) { + return new http_1.Jsonp(jsonpBackend, requestOptions); + }, [jsonp_backend_1.JSONPBackend, base_request_options_1.RequestOptions]), browser_jsonp_1.BrowserJsonp, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), jsonp_backend_1.JSONPBackend]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/router", ["angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/instruction", "angular2/src/router/route_registry", "angular2/src/router/location_strategy", "angular2/src/router/hash_location_strategy", "angular2/src/router/path_location_strategy", "angular2/src/router/location", "angular2/src/router/route_config_decorator", "angular2/src/router/route_definition", "angular2/src/router/lifecycle_annotations", "angular2/src/router/instruction", "angular2/angular2", "angular2/src/router/route_data", "angular2/src/router/location_strategy", "angular2/src/router/path_location_strategy", "angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/route_registry", "angular2/src/router/location", "angular2/core", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var router_1 = require("angular2/src/router/router"); + exports.Router = router_1.Router; + var router_outlet_1 = require("angular2/src/router/router_outlet"); + exports.RouterOutlet = router_outlet_1.RouterOutlet; + var router_link_1 = require("angular2/src/router/router_link"); + exports.RouterLink = router_link_1.RouterLink; + var instruction_1 = require("angular2/src/router/instruction"); + exports.RouteParams = instruction_1.RouteParams; + var route_registry_1 = require("angular2/src/router/route_registry"); + exports.RouteRegistry = route_registry_1.RouteRegistry; + var location_strategy_1 = require("angular2/src/router/location_strategy"); + exports.LocationStrategy = location_strategy_1.LocationStrategy; + var hash_location_strategy_1 = require("angular2/src/router/hash_location_strategy"); + exports.HashLocationStrategy = hash_location_strategy_1.HashLocationStrategy; + var path_location_strategy_1 = require("angular2/src/router/path_location_strategy"); + exports.PathLocationStrategy = path_location_strategy_1.PathLocationStrategy; + var location_1 = require("angular2/src/router/location"); + exports.Location = location_1.Location; + exports.APP_BASE_HREF = location_1.APP_BASE_HREF; + __export(require("angular2/src/router/route_config_decorator")); + __export(require("angular2/src/router/route_definition")); + var lifecycle_annotations_1 = require("angular2/src/router/lifecycle_annotations"); + exports.CanActivate = lifecycle_annotations_1.CanActivate; + var instruction_2 = require("angular2/src/router/instruction"); + exports.Instruction = instruction_2.Instruction; + exports.ComponentInstruction = instruction_2.ComponentInstruction; + var angular2_1 = require("angular2/angular2"); + exports.OpaqueToken = angular2_1.OpaqueToken; + var route_data_1 = require("angular2/src/router/route_data"); + exports.ROUTE_DATA = route_data_1.ROUTE_DATA; + var location_strategy_2 = require("angular2/src/router/location_strategy"); + var path_location_strategy_2 = require("angular2/src/router/path_location_strategy"); + var router_2 = require("angular2/src/router/router"); + var router_outlet_2 = require("angular2/src/router/router_outlet"); + var router_link_2 = require("angular2/src/router/router_link"); + var route_registry_2 = require("angular2/src/router/route_registry"); + var location_2 = require("angular2/src/router/location"); + var core_1 = require("angular2/core"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.ROUTER_PRIMARY_COMPONENT = lang_1.CONST_EXPR(new core_1.OpaqueToken('RouterPrimaryComponent')); + exports.ROUTER_DIRECTIVES = lang_1.CONST_EXPR([router_outlet_2.RouterOutlet, router_link_2.RouterLink]); + exports.ROUTER_BINDINGS = lang_1.CONST_EXPR([route_registry_2.RouteRegistry, lang_1.CONST_EXPR(new core_1.Binding(location_strategy_2.LocationStrategy, {toClass: path_location_strategy_2.PathLocationStrategy})), location_2.Location, lang_1.CONST_EXPR(new core_1.Binding(router_2.Router, { + toFactory: routerFactory, + deps: lang_1.CONST_EXPR([route_registry_2.RouteRegistry, location_2.Location, exports.ROUTER_PRIMARY_COMPONENT]) + }))]); + function routerFactory(registry, location, primaryComponent) { + return new router_2.RootRouter(registry, location, primaryComponent); + } + function routerBindings(primaryComponent) { + return [exports.ROUTER_BINDINGS, core_1.bind(exports.ROUTER_PRIMARY_COMPONENT).toValue(primaryComponent)]; + } + exports.routerBindings = routerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/angular2", ["angular2/core", "angular2/profile", "angular2/lifecycle_hooks", "angular2/bootstrap"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/core")); + __export(require("angular2/profile")); + __export(require("angular2/lifecycle_hooks")); + __export(require("angular2/bootstrap")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/angular2_sfx", ["angular2/angular2", "angular2/router", "angular2/http"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng = require("angular2/angular2"); + var router = require("angular2/router"); + var http = require("angular2/http"); + var _prevNg = window.ng; + window.ng = ng; + window.ngRouter = router; + window.ngHttp = http; + ng.noConflict = function() { + window.ng = _prevNg; + return ng; + }; + global.define = __define; + return module.exports; +}); + +}); +//# sourceMappingURLDisabled=angular2.sfx.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/http.dev.js b/2.0.0-snapshot/http.dev.js new file mode 100644 index 0000000000..ab9c2b8743 --- /dev/null +++ b/2.0.0-snapshot/http.dev.js @@ -0,0 +1,27435 @@ +"format register"; +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + function paramParser(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + var map = new collection_1.Map(); + if (rawParams.length > 0) { + var params = lang_1.StringWrapper.split(rawParams, new RegExp('&')); + collection_1.ListWrapper.forEach(params, function(param) { + var split = lang_1.StringWrapper.split(param, new RegExp('=')); + var key = split[0]; + var val = split[1]; + var list = lang_1.isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + }); + } + return map; + } + exports.URLSearchParamsUnionFixer = lang_1.CONST_EXPR("UnionFixer"); + var URLSearchParams = (function() { + function URLSearchParams(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + URLSearchParams.prototype.clone = function() { + var clone = new URLSearchParams(); + clone.appendAll(this); + return clone; + }; + URLSearchParams.prototype.has = function(param) { + return this.paramsMap.has(param); + }; + URLSearchParams.prototype.get = function(param) { + var storedParam = this.paramsMap.get(param); + if (collection_1.isListLikeIterable(storedParam)) { + return collection_1.ListWrapper.first(storedParam); + } else { + return null; + } + }; + URLSearchParams.prototype.getAll = function(param) { + var mapParam = this.paramsMap.get(param); + return lang_1.isPresent(mapParam) ? mapParam : []; + }; + URLSearchParams.prototype.set = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.setAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(value[0]); + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.append = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.appendAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.replaceAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.toString = function() { + var paramsList = []; + collection_1.MapWrapper.forEach(this.paramsMap, function(values, k) { + collection_1.ListWrapper.forEach(values, function(v) { + paramsList.push(k + '=' + v); + }); + }); + return collection_1.ListWrapper.join(paramsList, '&'); + }; + URLSearchParams.prototype.delete = function(param) { + collection_1.MapWrapper.delete(this.paramsMap, param); + }; + return URLSearchParams; + })(); + exports.URLSearchParams = URLSearchParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/headers", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Headers = (function() { + function Headers(headers) { + var _this = this; + if (lang_1.isBlank(headers)) { + this._headersMap = new collection_1.Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof collection_1.StringMap) { + this._headersMap = collection_1.MapWrapper.createFromStringMap(headers); + collection_1.MapWrapper.forEach(this._headersMap, function(v, k) { + if (!collection_1.isListLikeIterable(v)) { + var list = []; + list.push(v); + _this._headersMap.set(k, list); + } + }); + } + } + Headers.prototype.append = function(name, value) { + var mapName = this._headersMap.get(name); + var list = collection_1.isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }; + Headers.prototype.delete = function(name) { + collection_1.MapWrapper.delete(this._headersMap, name); + }; + Headers.prototype.forEach = function(fn) { + collection_1.MapWrapper.forEach(this._headersMap, fn); + }; + Headers.prototype.get = function(header) { + return collection_1.ListWrapper.first(this._headersMap.get(header)); + }; + Headers.prototype.has = function(header) { + return this._headersMap.has(header); + }; + Headers.prototype.keys = function() { + return collection_1.MapWrapper.keys(this._headersMap); + }; + Headers.prototype.set = function(header, value) { + var list = []; + if (collection_1.isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }; + Headers.prototype.values = function() { + return collection_1.MapWrapper.values(this._headersMap); + }; + Headers.prototype.getAll = function(header) { + var headers = this._headersMap.get(header); + return collection_1.isListLikeIterable(headers) ? headers : []; + }; + Headers.prototype.entries = function() { + throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class'); + }; + return Headers; + })(); + exports.Headers = Headers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/enums", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RequestMethods) { + RequestMethods[RequestMethods["Get"] = 0] = "Get"; + RequestMethods[RequestMethods["Post"] = 1] = "Post"; + RequestMethods[RequestMethods["Put"] = 2] = "Put"; + RequestMethods[RequestMethods["Delete"] = 3] = "Delete"; + RequestMethods[RequestMethods["Options"] = 4] = "Options"; + RequestMethods[RequestMethods["Head"] = 5] = "Head"; + RequestMethods[RequestMethods["Patch"] = 6] = "Patch"; + })(exports.RequestMethods || (exports.RequestMethods = {})); + var RequestMethods = exports.RequestMethods; + (function(ReadyStates) { + ReadyStates[ReadyStates["Unsent"] = 0] = "Unsent"; + ReadyStates[ReadyStates["Open"] = 1] = "Open"; + ReadyStates[ReadyStates["HeadersReceived"] = 2] = "HeadersReceived"; + ReadyStates[ReadyStates["Loading"] = 3] = "Loading"; + ReadyStates[ReadyStates["Done"] = 4] = "Done"; + ReadyStates[ReadyStates["Cancelled"] = 5] = "Cancelled"; + })(exports.ReadyStates || (exports.ReadyStates = {})); + var ReadyStates = exports.ReadyStates; + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(exports.ResponseTypes || (exports.ResponseTypes = {})); + var ResponseTypes = exports.ResponseTypes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.isJsObject = lang_1.isJsObject; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var ResponseOptions = (function() { + function ResponseOptions(_a) { + var _b = _a === void 0 ? {} : _a, + body = _b.body, + status = _b.status, + headers = _b.headers, + statusText = _b.statusText, + type = _b.type, + url = _b.url; + this.body = lang_1.isPresent(body) ? body : null; + this.status = lang_1.isPresent(status) ? status : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.statusText = lang_1.isPresent(statusText) ? statusText : null; + this.type = lang_1.isPresent(type) ? type : null; + this.url = lang_1.isPresent(url) ? url : null; + } + ResponseOptions.prototype.merge = function(options) { + return new ResponseOptions({ + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + status: lang_1.isPresent(options) && lang_1.isPresent(options.status) ? options.status : this.status, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + statusText: lang_1.isPresent(options) && lang_1.isPresent(options.statusText) ? options.statusText : this.statusText, + type: lang_1.isPresent(options) && lang_1.isPresent(options.type) ? options.type : this.type, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url + }); + }; + return ResponseOptions; + })(); + exports.ResponseOptions = ResponseOptions; + var BaseResponseOptions = (function(_super) { + __extends(BaseResponseOptions, _super); + function BaseResponseOptions() { + _super.call(this, { + status: 200, + statusText: 'Ok', + type: enums_1.ResponseTypes.Default, + headers: new headers_1.Headers() + }); + } + BaseResponseOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions); + return BaseResponseOptions; + })(ResponseOptions); + exports.BaseResponseOptions = BaseResponseOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 BrowserXhr = (function() { + function BrowserXhr() {} + BrowserXhr.prototype.build = function() { + return (new XMLHttpRequest()); + }; + BrowserXhr = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserXhr); + return BrowserXhr; + })(); + exports.BrowserXhr = BrowserXhr; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/src/core/di", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var _nextRequestId = 0; + exports.JSONP_HOME = '__ng_jsonp__'; + var _jsonpConnections = null; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = lang_1.global[exports.JSONP_HOME] = {}; + } + return _jsonpConnections; + } + var BrowserJsonp = (function() { + function BrowserJsonp() {} + BrowserJsonp.prototype.build = function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }; + BrowserJsonp.prototype.nextRequestID = function() { + return "__req" + _nextRequestId++; + }; + BrowserJsonp.prototype.requestCallback = function(id) { + return exports.JSONP_HOME + "." + id + ".finished"; + }; + BrowserJsonp.prototype.exposeConnection = function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }; + BrowserJsonp.prototype.removeConnection = function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }; + BrowserJsonp.prototype.send = function(node) { + document.body.appendChild((node)); + }; + BrowserJsonp.prototype.cleanup = function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + }; + BrowserJsonp = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp); + return BrowserJsonp; + })(); + exports.BrowserJsonp = BrowserJsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/src/core/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 static_request_1 = require("angular2/src/http/static_request"); + var enums_1 = require("angular2/src/http/enums"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var MockConnection = (function() { + function MockConnection(req) { + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Open; + this.request = req; + } + MockConnection.prototype.dispose = function() { + if (this.readyState !== enums_1.ReadyStates.Done) { + this.readyState = enums_1.ReadyStates.Cancelled; + } + }; + MockConnection.prototype.mockRespond = function(res) { + if (this.readyState === enums_1.ReadyStates.Done || this.readyState === enums_1.ReadyStates.Cancelled) { + throw new exceptions_1.BaseException('Connection has already been resolved'); + } + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callNext(this.response, res); + async_1.ObservableWrapper.callReturn(this.response); + }; + MockConnection.prototype.mockDownload = function(res) {}; + MockConnection.prototype.mockError = function(err) { + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callThrow(this.response, err); + async_1.ObservableWrapper.callReturn(this.response); + }; + return MockConnection; + })(); + exports.MockConnection = MockConnection; + var MockBackend = (function() { + function MockBackend() { + var _this = this; + this.connectionsArray = []; + this.connections = new async_1.EventEmitter(); + async_1.ObservableWrapper.subscribe(this.connections, function(connection) { + return _this.connectionsArray.push(connection); + }); + this.pendingConnections = new async_1.EventEmitter(); + } + MockBackend.prototype.verifyNoPendingRequests = function() { + var pending = 0; + async_1.ObservableWrapper.subscribe(this.pendingConnections, function(c) { + return pending++; + }); + if (pending > 0) + throw new exceptions_1.BaseException(pending + " pending connections to be resolved"); + }; + MockBackend.prototype.resolveAllConnections = function() { + async_1.ObservableWrapper.subscribe(this.connections, function(c) { + return c.readyState = 4; + }); + }; + MockBackend.prototype.createConnection = function(req) { + if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) { + throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req); + } + var connection = new MockConnection(req); + async_1.ObservableWrapper.callNext(this.connections, connection); + return connection; + }; + MockBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend); + return MockBackend; + })(); + exports.MockBackend = MockBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/core/facade/exceptions", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var URLSearchParams_UnionFixer = url_search_params_1.URLSearchParamsUnionFixer; + var ConnectionBackend = (function() { + function ConnectionBackend() {} + ConnectionBackend.prototype.createConnection = function(request) { + throw new exceptions_1.BaseException('Abstract!'); + }; + return ConnectionBackend; + })(); + exports.ConnectionBackend = ConnectionBackend; + var Connection = (function() { + function Connection() {} + Connection.prototype.dispose = function() { + throw new exceptions_1.BaseException('Abstract!'); + }; + return Connection; + })(); + exports.Connection = Connection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var headers_1 = require("angular2/src/http/headers"); + var lang_1 = require("angular2/src/core/facade/lang"); + var Request = (function() { + function Request(requestOptions) { + var url = requestOptions.url; + this.url = requestOptions.url; + if (lang_1.isPresent(requestOptions.search)) { + var search = requestOptions.search.toString(); + if (search.length > 0) { + var prefix = '?'; + if (lang_1.StringWrapper.contains(this.url, '?')) { + prefix = (this.url[this.url.length - 1] == '&') ? '' : '&'; + } + this.url = url + prefix + search; + } + } + this._body = requestOptions.body; + this.method = requestOptions.method; + this.headers = new headers_1.Headers(requestOptions.headers); + } + Request.prototype.text = function() { + return lang_1.isPresent(this._body) ? this._body.toString() : ''; + }; + return Request; + })(); + exports.Request = Request; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/core/di", "angular2/src/http/url_search_params"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var di_1 = require("angular2/src/core/di"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var RequestOptions = (function() { + function RequestOptions(_a) { + var _b = _a === void 0 ? {} : _a, + method = _b.method, + headers = _b.headers, + body = _b.body, + url = _b.url, + search = _b.search; + this.method = lang_1.isPresent(method) ? method : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.body = lang_1.isPresent(body) ? body : null; + this.url = lang_1.isPresent(url) ? url : null; + this.search = lang_1.isPresent(search) ? (lang_1.isString(search) ? new url_search_params_1.URLSearchParams((search)) : (search)) : null; + } + RequestOptions.prototype.merge = function(options) { + return new RequestOptions({ + method: lang_1.isPresent(options) && lang_1.isPresent(options.method) ? options.method : this.method, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url, + search: lang_1.isPresent(options) && lang_1.isPresent(options.search) ? (lang_1.isString(options.search) ? new url_search_params_1.URLSearchParams((options.search)) : (options.search).clone()) : this.search + }); + }; + return RequestOptions; + })(); + exports.RequestOptions = RequestOptions; + var BaseRequestOptions = (function(_super) { + __extends(BaseRequestOptions, _super); + function BaseRequestOptions() { + _super.call(this, { + method: enums_1.RequestMethods.Get, + headers: new headers_1.Headers() + }); + } + BaseRequestOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions); + return BaseRequestOptions; + })(RequestOptions); + exports.BaseRequestOptions = BaseRequestOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/http/http_utils"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var http_utils_1 = require("angular2/src/http/http_utils"); + var Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + Response.prototype.blob = function() { + throw new exceptions_1.BaseException('"blob()" method not implemented on Response superclass'); + }; + Response.prototype.json = function() { + var jsonResponse; + if (http_utils_1.isJsObject(this._body)) { + jsonResponse = this._body; + } else if (lang_1.isString(this._body)) { + jsonResponse = lang_1.Json.parse(this._body); + } + return jsonResponse; + }; + Response.prototype.text = function() { + return this._body.toString(); + }; + Response.prototype.arrayBuffer = function() { + throw new exceptions_1.BaseException('"arrayBuffer()" method not implemented on Response superclass'); + }; + return Response; + })(); + exports.Response = Response; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var async_1 = require("angular2/src/core/facade/async"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var _this = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== enums_1.RequestMethods.Get) { + throw exceptions_1.makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Loading; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = lang_1.StringWrapper.replace(url, '=JSONP_CALLBACK&', "=" + callback + "&"); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = lang_1.StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', function(event) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + if (!_this._finished) { + async_1.ObservableWrapper.callThrow(_this.response, exceptions_1.makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new base_response_options_1.ResponseOptions({body: _this._responseData}); + if (lang_1.isPresent(_this.baseResponseOptions)) { + responseOptions = _this.baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + }); + script.addEventListener('error', function(error) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + async_1.ObservableWrapper.callThrow(_this.response, error); + }); + _dom.send(script); + } + JSONPConnection.prototype.finished = function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === enums_1.ReadyStates.Cancelled) + return ; + this._responseData = data; + }; + JSONPConnection.prototype.dispose = function() { + this.readyState = enums_1.ReadyStates.Cancelled; + var script = this._script; + this._script = null; + if (lang_1.isPresent(script)) { + this._dom.cleanup(script); + } + async_1.ObservableWrapper.callReturn(this.response); + }; + return JSONPConnection; + })(); + exports.JSONPConnection = JSONPConnection; + var JSONPBackend = (function() { + function JSONPBackend(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + } + JSONPBackend.prototype.createConnection = function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }; + JSONPBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_jsonp_1.BrowserJsonp, base_response_options_1.ResponseOptions])], JSONPBackend); + return JSONPBackend; + })(); + exports.JSONPBackend = JSONPBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var decorators_1 = require("angular2/src/core/di/decorators"); + var interfaces_1 = require("angular2/src/http/interfaces"); + var static_request_1 = require("angular2/src/http/static_request"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var enums_1 = require("angular2/src/http/enums"); + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (lang_1.isPresent(providedOpts)) { + newOptions = newOptions.merge(new base_request_options_1.RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + search: providedOpts.search, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (lang_1.isPresent(method)) { + return newOptions.merge(new base_request_options_1.RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new base_request_options_1.RequestOptions({url: url})); + } + } + var Http = (function() { + function Http(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + } + Http.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + responseObservable = httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + } else if (url instanceof static_request_1.Request) { + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Http.prototype.get = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + }; + Http.prototype.post = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Post, url))); + }; + Http.prototype.put = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Put, url))); + }; + Http.prototype.delete = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Delete, url))); + }; + Http.prototype.patch = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Patch, url))); + }; + Http.prototype.head = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Head, url))); + }; + Http = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Http); + return Http; + })(); + exports.Http = Http; + var Jsonp = (function(_super) { + __extends(Jsonp, _super); + function Jsonp(backend, defaultOptions) { + _super.call(this, backend, defaultOptions); + } + Jsonp.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + url = new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url)); + } + if (url instanceof static_request_1.Request) { + if (url.method !== enums_1.RequestMethods.Get) { + exceptions_1.makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Jsonp = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Jsonp); + return Jsonp; + })(Http); + exports.Jsonp = Jsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_xhr", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var _this = this; + this.request = req; + this.response = new async_1.EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(enums_1.RequestMethods[req.method].toUpperCase(), req.url); + this._xhr.addEventListener('load', function(_) { + var response = lang_1.isPresent(_this._xhr.response) ? _this._xhr.response : _this._xhr.responseText; + var status = _this._xhr.status === 1223 ? 204 : _this._xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + var responseOptions = new base_response_options_1.ResponseOptions({ + body: response, + status: status + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + async_1.ObservableWrapper.callReturn(_this.response); + }); + this._xhr.addEventListener('error', function(err) { + var responseOptions = new base_response_options_1.ResponseOptions({ + body: err, + type: enums_1.ResponseTypes.Error + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callThrow(_this.response, new static_response_1.Response(responseOptions)); + }); + if (lang_1.isPresent(req.headers)) { + req.headers.forEach(function(value, name) { + _this._xhr.setRequestHeader(name, value); + }); + } + this._xhr.send(this.request.text()); + } + XHRConnection.prototype.dispose = function() { + this._xhr.abort(); + }; + return XHRConnection; + })(); + exports.XHRConnection = XHRConnection; + var XHRBackend = (function() { + function XHRBackend(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + } + XHRBackend.prototype.createConnection = function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }; + XHRBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_xhr_1.BrowserXhr, base_response_options_1.ResponseOptions])], XHRBackend); + return XHRBackend; + })(); + exports.XHRBackend = XHRBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/http", ["angular2/core", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/interfaces", "angular2/src/http/backends/browser_xhr", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/http", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var core_1 = require("angular2/core"); + var http_1 = require("angular2/src/http/http"); + var xhr_backend_1 = require("angular2/src/http/backends/xhr_backend"); + var jsonp_backend_1 = require("angular2/src/http/backends/jsonp_backend"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var mock_backend_1 = require("angular2/src/http/backends/mock_backend"); + exports.MockConnection = mock_backend_1.MockConnection; + exports.MockBackend = mock_backend_1.MockBackend; + var static_request_1 = require("angular2/src/http/static_request"); + exports.Request = static_request_1.Request; + var static_response_1 = require("angular2/src/http/static_response"); + exports.Response = static_response_1.Response; + var interfaces_1 = require("angular2/src/http/interfaces"); + exports.Connection = interfaces_1.Connection; + exports.ConnectionBackend = interfaces_1.ConnectionBackend; + var browser_xhr_2 = require("angular2/src/http/backends/browser_xhr"); + exports.BrowserXhr = browser_xhr_2.BrowserXhr; + var base_request_options_2 = require("angular2/src/http/base_request_options"); + exports.BaseRequestOptions = base_request_options_2.BaseRequestOptions; + exports.RequestOptions = base_request_options_2.RequestOptions; + var base_response_options_2 = require("angular2/src/http/base_response_options"); + exports.BaseResponseOptions = base_response_options_2.BaseResponseOptions; + exports.ResponseOptions = base_response_options_2.ResponseOptions; + var xhr_backend_2 = require("angular2/src/http/backends/xhr_backend"); + exports.XHRBackend = xhr_backend_2.XHRBackend; + exports.XHRConnection = xhr_backend_2.XHRConnection; + var jsonp_backend_2 = require("angular2/src/http/backends/jsonp_backend"); + exports.JSONPBackend = jsonp_backend_2.JSONPBackend; + exports.JSONPConnection = jsonp_backend_2.JSONPConnection; + var http_2 = require("angular2/src/http/http"); + exports.Http = http_2.Http; + exports.Jsonp = http_2.Jsonp; + var headers_1 = require("angular2/src/http/headers"); + exports.Headers = headers_1.Headers; + var enums_1 = require("angular2/src/http/enums"); + exports.ResponseTypes = enums_1.ResponseTypes; + exports.ReadyStates = enums_1.ReadyStates; + exports.RequestMethods = enums_1.RequestMethods; + var url_search_params_1 = require("angular2/src/http/url_search_params"); + exports.URLSearchParams = url_search_params_1.URLSearchParams; + exports.HTTP_BINDINGS = [core_1.bind(http_1.Http).toFactory(function(xhrBackend, requestOptions) { + return new http_1.Http(xhrBackend, requestOptions); + }, [xhr_backend_1.XHRBackend, base_request_options_1.RequestOptions]), browser_xhr_1.BrowserXhr, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), xhr_backend_1.XHRBackend]; + exports.JSONP_BINDINGS = [core_1.bind(http_1.Jsonp).toFactory(function(jsonpBackend, requestOptions) { + return new http_1.Jsonp(jsonpBackend, requestOptions); + }, [jsonp_backend_1.JSONPBackend, base_request_options_1.RequestOptions]), browser_jsonp_1.BrowserJsonp, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), jsonp_backend_1.JSONPBackend]; + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=http.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/http.js b/2.0.0-snapshot/http.js new file mode 100644 index 0000000000..e70d6a7f5d --- /dev/null +++ b/2.0.0-snapshot/http.js @@ -0,0 +1,28397 @@ +/*! ***************************************************************************** +Copyright (C) Microsoft. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +"use strict"; +var Reflect; +(function (Reflect) { + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var _Map = typeof Map === "function" ? Map : CreateMapPolyfill(); + var _Set = typeof Set === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + var __Metadata__ = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param targetKey (Optional) The property key to decorate. + * @param targetDescriptor (Optional) The property descriptor for the target key + * @remarks Decorators are applied in reverse order. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * C = Reflect.decorate(decoratorsArray, C); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, C.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(C, "staticMethod", + * Reflect.decorate(decoratorsArray, C, "staticMethod", + * Object.getOwnPropertyDescriptor(C, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(C.prototype, "method", + * Reflect.decorate(decoratorsArray, C.prototype, "method", + * Object.getOwnPropertyDescriptor(C.prototype, "method"))); + * + */ + function decorate(decorators, target, targetKey, targetDescriptor) { + if (!IsUndefined(targetDescriptor)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + else if (IsUndefined(targetKey)) { + throw new TypeError(); + } + else if (!IsObject(targetDescriptor)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithDescriptor(decorators, target, targetKey, targetDescriptor); + } + else if (!IsUndefined(targetKey)) { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + return DecoratePropertyWithoutDescriptor(decorators, target, targetKey); + } + else { + if (!IsArray(decorators)) { + throw new TypeError(); + } + else if (!IsConstructor(target)) { + throw new TypeError(); + } + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class C { + * } + * + * // property (on constructor, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class C { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class C { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class C { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, targetKey) { + if (!IsUndefined(targetKey)) { + if (!IsObject(target)) { + throw new TypeError(); + } + targetKey = ToPropertyKey(targetKey); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + else { + if (!IsConstructor(target)) { + throw new TypeError(); + } + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, undefined); + } + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param targetKey (Optional) The property key for the target. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, C); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, C, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, C.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + function paramParser(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + var map = new collection_1.Map(); + if (rawParams.length > 0) { + var params = lang_1.StringWrapper.split(rawParams, new RegExp('&')); + collection_1.ListWrapper.forEach(params, function(param) { + var split = lang_1.StringWrapper.split(param, new RegExp('=')); + var key = split[0]; + var val = split[1]; + var list = lang_1.isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + }); + } + return map; + } + exports.URLSearchParamsUnionFixer = lang_1.CONST_EXPR("UnionFixer"); + var URLSearchParams = (function() { + function URLSearchParams(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + URLSearchParams.prototype.clone = function() { + var clone = new URLSearchParams(); + clone.appendAll(this); + return clone; + }; + URLSearchParams.prototype.has = function(param) { + return this.paramsMap.has(param); + }; + URLSearchParams.prototype.get = function(param) { + var storedParam = this.paramsMap.get(param); + if (collection_1.isListLikeIterable(storedParam)) { + return collection_1.ListWrapper.first(storedParam); + } else { + return null; + } + }; + URLSearchParams.prototype.getAll = function(param) { + var mapParam = this.paramsMap.get(param); + return lang_1.isPresent(mapParam) ? mapParam : []; + }; + URLSearchParams.prototype.set = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.setAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(value[0]); + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.append = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.appendAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.replaceAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.toString = function() { + var paramsList = []; + collection_1.MapWrapper.forEach(this.paramsMap, function(values, k) { + collection_1.ListWrapper.forEach(values, function(v) { + paramsList.push(k + '=' + v); + }); + }); + return collection_1.ListWrapper.join(paramsList, '&'); + }; + URLSearchParams.prototype.delete = function(param) { + collection_1.MapWrapper.delete(this.paramsMap, param); + }; + return URLSearchParams; + })(); + exports.URLSearchParams = URLSearchParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/headers", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Headers = (function() { + function Headers(headers) { + var _this = this; + if (lang_1.isBlank(headers)) { + this._headersMap = new collection_1.Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof collection_1.StringMap) { + this._headersMap = collection_1.MapWrapper.createFromStringMap(headers); + collection_1.MapWrapper.forEach(this._headersMap, function(v, k) { + if (!collection_1.isListLikeIterable(v)) { + var list = []; + list.push(v); + _this._headersMap.set(k, list); + } + }); + } + } + Headers.prototype.append = function(name, value) { + var mapName = this._headersMap.get(name); + var list = collection_1.isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }; + Headers.prototype.delete = function(name) { + collection_1.MapWrapper.delete(this._headersMap, name); + }; + Headers.prototype.forEach = function(fn) { + collection_1.MapWrapper.forEach(this._headersMap, fn); + }; + Headers.prototype.get = function(header) { + return collection_1.ListWrapper.first(this._headersMap.get(header)); + }; + Headers.prototype.has = function(header) { + return this._headersMap.has(header); + }; + Headers.prototype.keys = function() { + return collection_1.MapWrapper.keys(this._headersMap); + }; + Headers.prototype.set = function(header, value) { + var list = []; + if (collection_1.isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }; + Headers.prototype.values = function() { + return collection_1.MapWrapper.values(this._headersMap); + }; + Headers.prototype.getAll = function(header) { + var headers = this._headersMap.get(header); + return collection_1.isListLikeIterable(headers) ? headers : []; + }; + Headers.prototype.entries = function() { + throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class'); + }; + return Headers; + })(); + exports.Headers = Headers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/enums", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RequestMethods) { + RequestMethods[RequestMethods["Get"] = 0] = "Get"; + RequestMethods[RequestMethods["Post"] = 1] = "Post"; + RequestMethods[RequestMethods["Put"] = 2] = "Put"; + RequestMethods[RequestMethods["Delete"] = 3] = "Delete"; + RequestMethods[RequestMethods["Options"] = 4] = "Options"; + RequestMethods[RequestMethods["Head"] = 5] = "Head"; + RequestMethods[RequestMethods["Patch"] = 6] = "Patch"; + })(exports.RequestMethods || (exports.RequestMethods = {})); + var RequestMethods = exports.RequestMethods; + (function(ReadyStates) { + ReadyStates[ReadyStates["Unsent"] = 0] = "Unsent"; + ReadyStates[ReadyStates["Open"] = 1] = "Open"; + ReadyStates[ReadyStates["HeadersReceived"] = 2] = "HeadersReceived"; + ReadyStates[ReadyStates["Loading"] = 3] = "Loading"; + ReadyStates[ReadyStates["Done"] = 4] = "Done"; + ReadyStates[ReadyStates["Cancelled"] = 5] = "Cancelled"; + })(exports.ReadyStates || (exports.ReadyStates = {})); + var ReadyStates = exports.ReadyStates; + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(exports.ResponseTypes || (exports.ResponseTypes = {})); + var ResponseTypes = exports.ResponseTypes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.isJsObject = lang_1.isJsObject; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var ResponseOptions = (function() { + function ResponseOptions(_a) { + var _b = _a === void 0 ? {} : _a, + body = _b.body, + status = _b.status, + headers = _b.headers, + statusText = _b.statusText, + type = _b.type, + url = _b.url; + this.body = lang_1.isPresent(body) ? body : null; + this.status = lang_1.isPresent(status) ? status : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.statusText = lang_1.isPresent(statusText) ? statusText : null; + this.type = lang_1.isPresent(type) ? type : null; + this.url = lang_1.isPresent(url) ? url : null; + } + ResponseOptions.prototype.merge = function(options) { + return new ResponseOptions({ + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + status: lang_1.isPresent(options) && lang_1.isPresent(options.status) ? options.status : this.status, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + statusText: lang_1.isPresent(options) && lang_1.isPresent(options.statusText) ? options.statusText : this.statusText, + type: lang_1.isPresent(options) && lang_1.isPresent(options.type) ? options.type : this.type, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url + }); + }; + return ResponseOptions; + })(); + exports.ResponseOptions = ResponseOptions; + var BaseResponseOptions = (function(_super) { + __extends(BaseResponseOptions, _super); + function BaseResponseOptions() { + _super.call(this, { + status: 200, + statusText: 'Ok', + type: enums_1.ResponseTypes.Default, + headers: new headers_1.Headers() + }); + } + BaseResponseOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions); + return BaseResponseOptions; + })(ResponseOptions); + exports.BaseResponseOptions = BaseResponseOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 BrowserXhr = (function() { + function BrowserXhr() {} + BrowserXhr.prototype.build = function() { + return (new XMLHttpRequest()); + }; + BrowserXhr = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserXhr); + return BrowserXhr; + })(); + exports.BrowserXhr = BrowserXhr; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/src/core/di", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var _nextRequestId = 0; + exports.JSONP_HOME = '__ng_jsonp__'; + var _jsonpConnections = null; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = lang_1.global[exports.JSONP_HOME] = {}; + } + return _jsonpConnections; + } + var BrowserJsonp = (function() { + function BrowserJsonp() {} + BrowserJsonp.prototype.build = function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }; + BrowserJsonp.prototype.nextRequestID = function() { + return "__req" + _nextRequestId++; + }; + BrowserJsonp.prototype.requestCallback = function(id) { + return exports.JSONP_HOME + "." + id + ".finished"; + }; + BrowserJsonp.prototype.exposeConnection = function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }; + BrowserJsonp.prototype.removeConnection = function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }; + BrowserJsonp.prototype.send = function(node) { + document.body.appendChild((node)); + }; + BrowserJsonp.prototype.cleanup = function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + }; + BrowserJsonp = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp); + return BrowserJsonp; + })(); + exports.BrowserJsonp = BrowserJsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/src/core/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 static_request_1 = require("angular2/src/http/static_request"); + var enums_1 = require("angular2/src/http/enums"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var MockConnection = (function() { + function MockConnection(req) { + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Open; + this.request = req; + } + MockConnection.prototype.dispose = function() { + if (this.readyState !== enums_1.ReadyStates.Done) { + this.readyState = enums_1.ReadyStates.Cancelled; + } + }; + MockConnection.prototype.mockRespond = function(res) { + if (this.readyState === enums_1.ReadyStates.Done || this.readyState === enums_1.ReadyStates.Cancelled) { + throw new exceptions_1.BaseException('Connection has already been resolved'); + } + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callNext(this.response, res); + async_1.ObservableWrapper.callReturn(this.response); + }; + MockConnection.prototype.mockDownload = function(res) {}; + MockConnection.prototype.mockError = function(err) { + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callThrow(this.response, err); + async_1.ObservableWrapper.callReturn(this.response); + }; + return MockConnection; + })(); + exports.MockConnection = MockConnection; + var MockBackend = (function() { + function MockBackend() { + var _this = this; + this.connectionsArray = []; + this.connections = new async_1.EventEmitter(); + async_1.ObservableWrapper.subscribe(this.connections, function(connection) { + return _this.connectionsArray.push(connection); + }); + this.pendingConnections = new async_1.EventEmitter(); + } + MockBackend.prototype.verifyNoPendingRequests = function() { + var pending = 0; + async_1.ObservableWrapper.subscribe(this.pendingConnections, function(c) { + return pending++; + }); + if (pending > 0) + throw new exceptions_1.BaseException(pending + " pending connections to be resolved"); + }; + MockBackend.prototype.resolveAllConnections = function() { + async_1.ObservableWrapper.subscribe(this.connections, function(c) { + return c.readyState = 4; + }); + }; + MockBackend.prototype.createConnection = function(req) { + if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) { + throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req); + } + var connection = new MockConnection(req); + async_1.ObservableWrapper.callNext(this.connections, connection); + return connection; + }; + MockBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend); + return MockBackend; + })(); + exports.MockBackend = MockBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/core/facade/exceptions", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var URLSearchParams_UnionFixer = url_search_params_1.URLSearchParamsUnionFixer; + var ConnectionBackend = (function() { + function ConnectionBackend() {} + ConnectionBackend.prototype.createConnection = function(request) { + throw new exceptions_1.BaseException('Abstract!'); + }; + return ConnectionBackend; + })(); + exports.ConnectionBackend = ConnectionBackend; + var Connection = (function() { + function Connection() {} + Connection.prototype.dispose = function() { + throw new exceptions_1.BaseException('Abstract!'); + }; + return Connection; + })(); + exports.Connection = Connection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var headers_1 = require("angular2/src/http/headers"); + var lang_1 = require("angular2/src/core/facade/lang"); + var Request = (function() { + function Request(requestOptions) { + var url = requestOptions.url; + this.url = requestOptions.url; + if (lang_1.isPresent(requestOptions.search)) { + var search = requestOptions.search.toString(); + if (search.length > 0) { + var prefix = '?'; + if (lang_1.StringWrapper.contains(this.url, '?')) { + prefix = (this.url[this.url.length - 1] == '&') ? '' : '&'; + } + this.url = url + prefix + search; + } + } + this._body = requestOptions.body; + this.method = requestOptions.method; + this.headers = new headers_1.Headers(requestOptions.headers); + } + Request.prototype.text = function() { + return lang_1.isPresent(this._body) ? this._body.toString() : ''; + }; + return Request; + })(); + exports.Request = Request; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/core/di", "angular2/src/http/url_search_params"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var di_1 = require("angular2/src/core/di"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var RequestOptions = (function() { + function RequestOptions(_a) { + var _b = _a === void 0 ? {} : _a, + method = _b.method, + headers = _b.headers, + body = _b.body, + url = _b.url, + search = _b.search; + this.method = lang_1.isPresent(method) ? method : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.body = lang_1.isPresent(body) ? body : null; + this.url = lang_1.isPresent(url) ? url : null; + this.search = lang_1.isPresent(search) ? (lang_1.isString(search) ? new url_search_params_1.URLSearchParams((search)) : (search)) : null; + } + RequestOptions.prototype.merge = function(options) { + return new RequestOptions({ + method: lang_1.isPresent(options) && lang_1.isPresent(options.method) ? options.method : this.method, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url, + search: lang_1.isPresent(options) && lang_1.isPresent(options.search) ? (lang_1.isString(options.search) ? new url_search_params_1.URLSearchParams((options.search)) : (options.search).clone()) : this.search + }); + }; + return RequestOptions; + })(); + exports.RequestOptions = RequestOptions; + var BaseRequestOptions = (function(_super) { + __extends(BaseRequestOptions, _super); + function BaseRequestOptions() { + _super.call(this, { + method: enums_1.RequestMethods.Get, + headers: new headers_1.Headers() + }); + } + BaseRequestOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions); + return BaseRequestOptions; + })(RequestOptions); + exports.BaseRequestOptions = BaseRequestOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/http/http_utils"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var http_utils_1 = require("angular2/src/http/http_utils"); + var Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + Response.prototype.blob = function() { + throw new exceptions_1.BaseException('"blob()" method not implemented on Response superclass'); + }; + Response.prototype.json = function() { + var jsonResponse; + if (http_utils_1.isJsObject(this._body)) { + jsonResponse = this._body; + } else if (lang_1.isString(this._body)) { + jsonResponse = lang_1.Json.parse(this._body); + } + return jsonResponse; + }; + Response.prototype.text = function() { + return this._body.toString(); + }; + Response.prototype.arrayBuffer = function() { + throw new exceptions_1.BaseException('"arrayBuffer()" method not implemented on Response superclass'); + }; + return Response; + })(); + exports.Response = Response; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var async_1 = require("angular2/src/core/facade/async"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var _this = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== enums_1.RequestMethods.Get) { + throw exceptions_1.makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Loading; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = lang_1.StringWrapper.replace(url, '=JSONP_CALLBACK&', "=" + callback + "&"); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = lang_1.StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', function(event) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + if (!_this._finished) { + async_1.ObservableWrapper.callThrow(_this.response, exceptions_1.makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new base_response_options_1.ResponseOptions({body: _this._responseData}); + if (lang_1.isPresent(_this.baseResponseOptions)) { + responseOptions = _this.baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + }); + script.addEventListener('error', function(error) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + async_1.ObservableWrapper.callThrow(_this.response, error); + }); + _dom.send(script); + } + JSONPConnection.prototype.finished = function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === enums_1.ReadyStates.Cancelled) + return ; + this._responseData = data; + }; + JSONPConnection.prototype.dispose = function() { + this.readyState = enums_1.ReadyStates.Cancelled; + var script = this._script; + this._script = null; + if (lang_1.isPresent(script)) { + this._dom.cleanup(script); + } + async_1.ObservableWrapper.callReturn(this.response); + }; + return JSONPConnection; + })(); + exports.JSONPConnection = JSONPConnection; + var JSONPBackend = (function() { + function JSONPBackend(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + } + JSONPBackend.prototype.createConnection = function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }; + JSONPBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_jsonp_1.BrowserJsonp, base_response_options_1.ResponseOptions])], JSONPBackend); + return JSONPBackend; + })(); + exports.JSONPBackend = JSONPBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var decorators_1 = require("angular2/src/core/di/decorators"); + var interfaces_1 = require("angular2/src/http/interfaces"); + var static_request_1 = require("angular2/src/http/static_request"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var enums_1 = require("angular2/src/http/enums"); + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (lang_1.isPresent(providedOpts)) { + newOptions = newOptions.merge(new base_request_options_1.RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + search: providedOpts.search, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (lang_1.isPresent(method)) { + return newOptions.merge(new base_request_options_1.RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new base_request_options_1.RequestOptions({url: url})); + } + } + var Http = (function() { + function Http(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + } + Http.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + responseObservable = httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + } else if (url instanceof static_request_1.Request) { + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Http.prototype.get = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + }; + Http.prototype.post = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Post, url))); + }; + Http.prototype.put = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Put, url))); + }; + Http.prototype.delete = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Delete, url))); + }; + Http.prototype.patch = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Patch, url))); + }; + Http.prototype.head = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Head, url))); + }; + Http = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Http); + return Http; + })(); + exports.Http = Http; + var Jsonp = (function(_super) { + __extends(Jsonp, _super); + function Jsonp(backend, defaultOptions) { + _super.call(this, backend, defaultOptions); + } + Jsonp.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + url = new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url)); + } + if (url instanceof static_request_1.Request) { + if (url.method !== enums_1.RequestMethods.Get) { + exceptions_1.makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Jsonp = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Jsonp); + return Jsonp; + })(Http); + exports.Jsonp = Jsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_xhr", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var _this = this; + this.request = req; + this.response = new async_1.EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(enums_1.RequestMethods[req.method].toUpperCase(), req.url); + this._xhr.addEventListener('load', function(_) { + var response = lang_1.isPresent(_this._xhr.response) ? _this._xhr.response : _this._xhr.responseText; + var status = _this._xhr.status === 1223 ? 204 : _this._xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + var responseOptions = new base_response_options_1.ResponseOptions({ + body: response, + status: status + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + async_1.ObservableWrapper.callReturn(_this.response); + }); + this._xhr.addEventListener('error', function(err) { + var responseOptions = new base_response_options_1.ResponseOptions({ + body: err, + type: enums_1.ResponseTypes.Error + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callThrow(_this.response, new static_response_1.Response(responseOptions)); + }); + if (lang_1.isPresent(req.headers)) { + req.headers.forEach(function(value, name) { + _this._xhr.setRequestHeader(name, value); + }); + } + this._xhr.send(this.request.text()); + } + XHRConnection.prototype.dispose = function() { + this._xhr.abort(); + }; + return XHRConnection; + })(); + exports.XHRConnection = XHRConnection; + var XHRBackend = (function() { + function XHRBackend(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + } + XHRBackend.prototype.createConnection = function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }; + XHRBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_xhr_1.BrowserXhr, base_response_options_1.ResponseOptions])], XHRBackend); + return XHRBackend; + })(); + exports.XHRBackend = XHRBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/http", ["angular2/core", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/interfaces", "angular2/src/http/backends/browser_xhr", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/http", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var core_1 = require("angular2/core"); + var http_1 = require("angular2/src/http/http"); + var xhr_backend_1 = require("angular2/src/http/backends/xhr_backend"); + var jsonp_backend_1 = require("angular2/src/http/backends/jsonp_backend"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var mock_backend_1 = require("angular2/src/http/backends/mock_backend"); + exports.MockConnection = mock_backend_1.MockConnection; + exports.MockBackend = mock_backend_1.MockBackend; + var static_request_1 = require("angular2/src/http/static_request"); + exports.Request = static_request_1.Request; + var static_response_1 = require("angular2/src/http/static_response"); + exports.Response = static_response_1.Response; + var interfaces_1 = require("angular2/src/http/interfaces"); + exports.Connection = interfaces_1.Connection; + exports.ConnectionBackend = interfaces_1.ConnectionBackend; + var browser_xhr_2 = require("angular2/src/http/backends/browser_xhr"); + exports.BrowserXhr = browser_xhr_2.BrowserXhr; + var base_request_options_2 = require("angular2/src/http/base_request_options"); + exports.BaseRequestOptions = base_request_options_2.BaseRequestOptions; + exports.RequestOptions = base_request_options_2.RequestOptions; + var base_response_options_2 = require("angular2/src/http/base_response_options"); + exports.BaseResponseOptions = base_response_options_2.BaseResponseOptions; + exports.ResponseOptions = base_response_options_2.ResponseOptions; + var xhr_backend_2 = require("angular2/src/http/backends/xhr_backend"); + exports.XHRBackend = xhr_backend_2.XHRBackend; + exports.XHRConnection = xhr_backend_2.XHRConnection; + var jsonp_backend_2 = require("angular2/src/http/backends/jsonp_backend"); + exports.JSONPBackend = jsonp_backend_2.JSONPBackend; + exports.JSONPConnection = jsonp_backend_2.JSONPConnection; + var http_2 = require("angular2/src/http/http"); + exports.Http = http_2.Http; + exports.Jsonp = http_2.Jsonp; + var headers_1 = require("angular2/src/http/headers"); + exports.Headers = headers_1.Headers; + var enums_1 = require("angular2/src/http/enums"); + exports.ResponseTypes = enums_1.ResponseTypes; + exports.ReadyStates = enums_1.ReadyStates; + exports.RequestMethods = enums_1.RequestMethods; + var url_search_params_1 = require("angular2/src/http/url_search_params"); + exports.URLSearchParams = url_search_params_1.URLSearchParams; + exports.HTTP_BINDINGS = [core_1.bind(http_1.Http).toFactory(function(xhrBackend, requestOptions) { + return new http_1.Http(xhrBackend, requestOptions); + }, [xhr_backend_1.XHRBackend, base_request_options_1.RequestOptions]), browser_xhr_1.BrowserXhr, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), xhr_backend_1.XHRBackend]; + exports.JSONP_BINDINGS = [core_1.bind(http_1.Jsonp).toFactory(function(jsonpBackend, requestOptions) { + return new http_1.Jsonp(jsonpBackend, requestOptions); + }, [jsonp_backend_1.JSONPBackend, base_request_options_1.RequestOptions]), browser_jsonp_1.BrowserJsonp, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), jsonp_backend_1.JSONPBackend]; + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=http.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/http.min.js b/2.0.0-snapshot/http.min.js new file mode 100644 index 0000000000..1c48ad75d5 --- /dev/null +++ b/2.0.0-snapshot/http.min.js @@ -0,0 +1,28 @@ +"use strict";var Reflect;!function(e){function t(e,t,r,n){if(C(n)){if(C(r)){if(!R(e))throw new TypeError;if(!P(t))throw new TypeError;return p(e,t)}if(!R(e))throw new TypeError;if(!E(t))throw new TypeError;return r=S(r),f(e,t,r)}if(!R(e))throw new TypeError;if(!E(t))throw new TypeError;if(C(r))throw new TypeError;if(!E(n))throw new TypeError;return r=S(r),d(e,t,r,n)}function r(e,t){function r(r,n){if(C(n)){if(!P(r))throw new TypeError;_(e,t,r,void 0)}else{if(!E(r))throw new TypeError;n=S(n),_(e,t,r,n)}}return r}function n(e,t,r,n){if(!E(r))throw new TypeError;return C(n)||(n=S(n)),_(e,t,r,n)}function i(e,t,r){if(!E(t))throw new TypeError;return C(r)||(r=S(r)),g(e,t,r)}function o(e,t,r){if(!E(t))throw new TypeError;return C(r)||(r=S(r)),m(e,t,r)}function a(e,t,r){if(!E(t))throw new TypeError;return C(r)||(r=S(r)),v(e,t,r)}function s(e,t,r){if(!E(t))throw new TypeError;return C(r)||(r=S(r)),y(e,t,r)}function c(e,t){if(!E(e))throw new TypeError;return C(t)||(t=S(t)),b(e,t)}function l(e,t){if(!E(e))throw new TypeError;return C(t)||(t=S(t)),w(e,t)}function u(e,t,r){if(!E(t))throw new TypeError;C(r)||(r=S(r));var n=h(t,r,!1);if(C(n))return!1;if(!n["delete"](e))return!1;if(n.size>0)return!0;var i=k.get(t);return i["delete"](r),i.size>0?!0:(k["delete"](t),!0)}function p(e,t){for(var r=e.length-1;r>=0;--r){var n=e[r],i=n(t);if(!C(i)){if(!P(i))throw new TypeError;t=i}}return t}function d(e,t,r,n){for(var i=e.length-1;i>=0;--i){var o=e[i],a=o(t,r,n);if(!C(a)){if(!E(a))throw new TypeError;n=a}}return n}function f(e,t,r){for(var n=e.length-1;n>=0;--n){var i=e[n];i(t,r)}}function h(e,t,r){var n=k.get(e);if(!n){if(!r)return void 0;n=new T,k.set(e,n)}var i=n.get(t);if(!i){if(!r)return void 0;i=new T,n.set(t,i)}return i}function g(e,t,r){var n=m(e,t,r);if(n)return!0;var i=D(t);return null!==i?g(e,i,r):!1}function m(e,t,r){var n=h(t,r,!1);return void 0===n?!1:Boolean(n.has(e))}function v(e,t,r){var n=m(e,t,r);if(n)return y(e,t,r);var i=D(t);return null!==i?v(e,i,r):void 0}function y(e,t,r){var n=h(t,r,!1);return void 0===n?void 0:n.get(e)}function _(e,t,r,n){var i=h(r,n,!0);i.set(e,t)}function b(e,t){var r=w(e,t),n=D(e);if(null===n)return r;var i=b(n,t);if(i.length<=0)return r;if(r.length<=0)return i;for(var o=new N,a=[],s=0;s=0?(this._cache=e,!0):!1},get:function(e){var t=this._find(e);return t>=0?(this._cache=e,this._values[t]):void 0},set:function(e,t){return this["delete"](e),this._keys.push(e),this._values.push(t),this._cache=e,this},"delete":function(e){var r=this._find(e);return r>=0?(this._keys.splice(r,1),this._values.splice(r,1),this._cache=t,!0):!1},clear:function(){this._keys.length=0,this._values.length=0,this._cache=t},forEach:function(e,t){for(var r=this.size,n=0;r>n;++n){var i=this._keys[n],o=this._values[n];this._cache=i,e.call(this,o,i,this)}},_find:function(e){for(var t=this._keys,r=t.length,n=0;r>n;++n)if(t[n]===e)return n;return-1}},e}function O(){function e(){this._map=new T}return e.prototype={get size(){return this._map.length},has:function(e){return this._map.has(e)},add:function(e){return this._map.set(e,e),this},"delete":function(e){return this._map["delete"](e)},clear:function(){this._map.clear()},forEach:function(e,t){this._map.forEach(e,t)}},e}function M(){function e(){this._key=i()}function t(e,t){for(var r=0;t>r;++r)e[r]=255*Math.random()|0}function r(e){if(c){var r=c.randomBytes(e);return r}if("function"==typeof Uint8Array){var r=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(r):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(r):t(r,e),r}var r=new Array(e);return t(r,e),r}function n(){var e=r(a);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",n=0;a>n;++n){var i=e[n];(4===n||6===n||8===n)&&(t+="-"),16>i&&(t+="0"),t+=i.toString(16).toLowerCase()}return t}function i(){var e;do e="@@WeakMap@@"+n();while(l.call(u,e));return u[e]=!0,e}function o(e,t){if(!l.call(e,p)){if(!t)return void 0;Object.defineProperty(e,p,{value:Object.create(null)})}return e[p]}var a=16,s="undefined"!=typeof global&&"[object process]"===Object.prototype.toString.call(global.process),c=s&&require("crypto"),l=Object.prototype.hasOwnProperty,u={},p=i();return e.prototype={has:function(e){var t=o(e,!1);return t?this._key in t:!1},get:function(e){var t=o(e,!1);return t?t[this._key]:void 0},set:function(e,t){var r=o(e,!0);return r[this._key]=t,this},"delete":function(e){var t=o(e,!1);return t&&this._key in t?delete t[this._key]:!1},clear:function(){this._key=i()}},e}var A=Object.getPrototypeOf(Function),T="function"==typeof Map?Map:I(),N="function"==typeof Set?Set:O(),B="function"==typeof WeakMap?WeakMap:M(),k=new B;e.decorate=t,e.metadata=r,e.defineMetadata=n,e.hasMetadata=i,e.hasOwnMetadata=o,e.getMetadata=a,e.getOwnMetadata=s,e.getMetadataKeys=c,e.getOwnMetadataKeys=l,e.deleteMetadata=u,function(t){if("undefined"!=typeof t.Reflect){if(t.Reflect!==e)for(var r in e)t.Reflect[r]=e[r]}else t.Reflect=e}("undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope?self:"undefined"!=typeof global?global:Function("return this;")())}(Reflect||(Reflect={})),System.register("angular2/src/core/facade/lang",[],!0,function(e,t,r){function n(e){return e.name}function i(){return N}function o(e){return e}function a(){return function(e){return e}}function s(){return function(e){return e}}function c(e){return void 0!==e&&null!==e}function l(e){return void 0===e||null===e}function u(e){return"string"==typeof e}function p(e){return"function"==typeof e}function d(e){return p(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return e instanceof T.Promise}function g(e){return Array.isArray(e)}function m(e){return"number"==typeof e}function v(e){return e instanceof t.Date&&!isNaN(e.valueOf())}function y(e){if("string"==typeof e)return e;if(void 0===e||null===e)return""+e;if(e.name)return e.name;var t=e.toString(),r=t.indexOf("\n");return-1===r?t:t.substring(0,r)}function _(e){return e}function b(e,t){return e}function w(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}function C(e){return e}function R(e){return l(e)?null:e}function E(e){return l(e)?!1:e}function P(e){return null!==e&&("function"==typeof e||"object"==typeof e)}function x(e){console.log(e)}function S(e,t,r){for(var n=t.split("."),i=e;n.length>1;){var o=n.shift();i=i.hasOwnProperty(o)?i[o]:i[o]={}}(void 0===i||null===i)&&(i={}),i[n.shift()]=r}function D(){if(l(q))if(c(Symbol)&&c(Symbol.iterator))q=Symbol.iterator;else for(var e=Object.getOwnPropertyNames(Map.prototype),t=0;te?-1:e>t?1:0},e}();t.StringWrapper=B;var k=function(){function e(e){void 0===e&&(e=[]),this.parts=e}return e.prototype.add=function(e){this.parts.push(e)},e.prototype.toString=function(){return this.parts.join("")},e}();t.StringJoiner=k;var V=function(e){function t(t){e.call(this,t),this.message=t}return A(t,e),t.prototype.toString=function(){return this.message},t}(Error);t.NumberParseError=V;var j=function(){function e(){}return e.toFixed=function(e,t){return e.toFixed(t)},e.equal=function(e,t){return e===t},e.parseIntAutoRadix=function(e){var t=parseInt(e);if(isNaN(t))throw new V("Invalid integer literal when parsing "+e);return t},e.parseInt=function(e,t){if(10==t){if(/^(\-|\+)?[0-9]+$/.test(e))return parseInt(e,t)}else if(16==t){if(/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(e))return parseInt(e,t)}else{var r=parseInt(e,t);if(!isNaN(r))return r}throw new V("Invalid integer literal when parsing "+e+" in base "+t)},e.parseFloat=function(e){return parseFloat(e)},Object.defineProperty(e,"NaN",{get:function(){return 0/0},enumerable:!0,configurable:!0}),e.isNaN=function(e){return isNaN(e)},e.isInteger=function(e){return Number.isInteger(e)},e}();t.NumberWrapper=j,t.RegExp=T.RegExp;var L=function(){function e(){}return e.create=function(e,t){return void 0===t&&(t=""),t=t.replace(/g/g,""),new T.RegExp(e,t+"g")},e.firstMatch=function(e,t){return e.lastIndex=0,e.exec(t)},e.test=function(e,t){return e.lastIndex=0,e.test(t)},e.matcher=function(e,t){return e.lastIndex=0,{re:e,input:t}},e}();t.RegExpWrapper=L;var W=function(){function e(){}return e.next=function(e){return e.re.exec(e.input)},e}();t.RegExpMatcherWrapper=W;var F=function(){function e(){}return e.apply=function(e,t){return e.apply(null,t)},e}();t.FunctionWrapper=F,t.looseIdentical=w,t.getMapKey=C,t.normalizeBlank=R,t.normalizeBool=E,t.isJsObject=P,t.print=x;var H=function(){function e(){}return e.parse=function(e){return T.JSON.parse(e)},e.stringify=function(e){return T.JSON.stringify(e,null,2)},e}();t.Json=H;var U=function(){function e(){}return e.create=function(e,r,n,i,o,a,s){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===i&&(i=0),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),new t.Date(e,r-1,n,i,o,a,s)},e.fromMillis=function(e){return new t.Date(e)},e.toMillis=function(e){return e.getTime()},e.now=function(){return new t.Date},e.toJson=function(e){return e.toJSON()},e}();t.DateWrapper=U,t.setValueOnPath=S;var q=null;return t.getSymbolIterator=D,I.define=O,r.exports}),System.register("angular2/src/core/di/metadata",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this.token=e}return e.prototype.toString=function(){return"@Inject("+s.stringify(this.token)+")"},e=o([s.CONST(),a("design:paramtypes",[Object])],e)}();t.InjectMetadata=c;var l=function(){function e(){}return e.prototype.toString=function(){return"@Optional()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.OptionalMetadata=l;var u=function(){function e(){}return Object.defineProperty(e.prototype,"token",{get:function(){return null},enumerable:!0,configurable:!0}),e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.DependencyMetadata=u;var p=function(){function e(){}return e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.InjectableMetadata=p;var d=function(){function e(){}return e.prototype.toString=function(){return"@Self()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SelfMetadata=d;var f=function(){function e(){}return e.prototype.toString=function(){return"@SkipSelf()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.SkipSelfMetadata=f;var h=function(){function e(){}return e.prototype.toString=function(){return"@Host()"},e=o([s.CONST(),a("design:paramtypes",[])],e)}();return t.HostMetadata=h,n.define=i,r.exports}),System.register("angular2/src/core/util/decorators",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return p.isFunction(e)&&e.hasOwnProperty("annotation")&&(e=e.annotation),e}function i(e,t){if(e===Object||e===String||e===Function||e===Number||e===Array)throw new Error("Can not use native "+p.stringify(e)+" as constructor");if(p.isFunction(e))return e;if(e instanceof Array){var r=e,i=e[e.length-1];if(!p.isFunction(i))throw new Error("Last position of Class method array must be Function in key "+t+" was '"+p.stringify(i)+"'");var o=r.length-1;if(o!=i.length)throw new Error("Number of annotations ("+o+") does not match number of arguments ("+i.length+") in the function: "+p.stringify(i));for(var a=[],s=0,c=r.length-1;c>s;s++){var l=[];a.push(l);var u=r[s];if(u instanceof Array)for(var f=0;f-1?(e.splice(r,1),!0):!1},e.clear=function(e){e.length=0},e.join=function(e,t){return e.join(t)},e.isEmpty=function(e){return 0==e.length},e.fill=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=null),e.fill(t,r,null===n?e.length:n)},e.equals=function(e,t){if(e.length!=t.length)return!1;for(var r=0;rn&&(r=o,n=a)}}return r},e}();t.ListWrapper=h,t.isListLikeIterable=n,t.iterateListLike=i;var g=function(){var e=new t.Set([1,2,3]);return 3===e.size?function(e){return new t.Set(e)}:function(e){var r=new t.Set(e);if(r.size!==e.length)for(var n=0;n1){var t=n(c.ListWrapper.reversed(e)),r=c.ListWrapper.map(t,function(e){return l.stringify(e.token)});return" ("+r.join(" -> ")+")"}return""}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=function(e){function t(t,r,n){e.call(this,"DI Exception"),this.keys=[r],this.injectors=[t],this.constructResolvingMessage=n,this.message=this.constructResolvingMessage(this.keys)}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t),this.message=this.constructResolvingMessage(this.keys)},Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(u.BaseException);t.AbstractBindingError=p;var d=function(e){function t(t,r){e.call(this,t,r,function(e){var t=l.stringify(c.ListWrapper.first(e).token);return"No provider for "+t+"!"+i(e)})}return s(t,e),t}(p);t.NoBindingError=d;var f=function(e){function t(t,r){e.call(this,t,r,function(e){return"Cannot instantiate cyclic dependency!"+i(e)})}return s(t,e),t}(p);t.CyclicDependencyError=f;var h=function(e){function t(t,r,n,i){e.call(this,"DI Exception",r,n,null),this.keys=[i],this.injectors=[t]}return s(t,e),t.prototype.addKey=function(e,t){this.injectors.push(e),this.keys.push(t)},Object.defineProperty(t.prototype,"wrapperMessage",{get:function(){var e=l.stringify(c.ListWrapper.first(this.keys).token);return"Error during instantiation of "+e+"!"+i(this.keys)+"."},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"causeKey",{get:function(){return this.keys[0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this.injectors[this.injectors.length-1].debugContext()},enumerable:!0,configurable:!0}),t}(u.WrappedException);t.InstantiationError=h;var g=function(e){function t(t){e.call(this,"Invalid binding - only instances of Binding and Type are allowed, got: "+t.toString())}return s(t,e),t}(u.BaseException);t.InvalidBindingError=g;var m=function(e){function t(r,n){e.call(this,t._genMessage(r,n))}return s(t,e),t._genMessage=function(e,t){for(var r=[],n=0,i=t.length;i>n;n++){var o=t[n];r.push(l.isBlank(o)||0==o.length?"?":c.ListWrapper.map(o,l.stringify).join(" "))}return"Cannot resolve all parameters for "+l.stringify(e)+"("+r.join(", ")+"). Make sure they all have valid type or annotations."},t}(u.BaseException);t.NoAnnotationError=m;var v=function(e){function t(t){e.call(this,"Index "+t+" is out-of-bounds.")}return s(t,e),t}(u.BaseException);t.OutOfBoundsError=v;var y=function(e){function t(t,r){e.call(this,"Cannot mix multi bindings and regular bindings, got: "+t.toString()+" "+r.toString())}return s(t,e),t}(u.BaseException);return t.MixingMultiBindingsWithRegularBindings=y,o.define=a,r.exports}),System.register("angular2/src/core/di/opaque_token",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(e){this._desc=e}return e.prototype.toString=function(){return"Token "+this._desc},e=o([s.CONST(),a("design:paramtypes",[String])],e)}();return t.OpaqueToken=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/constants",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return a.isBlank(e)||e===s.Default}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang");!function(e){e[e.CheckOnce=0]="CheckOnce",e[e.Checked=1]="Checked",e[e.CheckAlways=2]="CheckAlways",e[e.Detached=3]="Detached",e[e.OnPush=4]="OnPush",e[e.Default=5]="Default",e[e.OnPushObserve=6]="OnPushObserve"}(t.ChangeDetectionStrategy||(t.ChangeDetectionStrategy={}));var s=t.ChangeDetectionStrategy;return t.CHANGE_DECTION_STRATEGY_VALUES=[s.CheckOnce,s.Checked,s.CheckAlways,s.Detached,s.OnPush,s.Default,s.OnPushObserve],t.isDefaultChangeDetectionStrategy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector",[],!0,function(e,t,r){function n(e){return e.constructor.prototype.onDestroy}var i=System.global,o=i.define;return i.define=void 0,t.implementsOnDestroy=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/binding_record",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a="directiveLifecycle",s="native",c="directive",l="elementProperty",u="elementAttribute",p="elementClass",d="elementStyle",f="textNode",h="event",g="hostEvent",m=function(){function e(e,t,r,n,i){this.mode=e,this.elementIndex=t,this.name=r,this.unit=n,this.debug=i}return e.prototype.isDirective=function(){return this.mode===c},e.prototype.isElementProperty=function(){return this.mode===l},e.prototype.isElementAttribute=function(){return this.mode===u},e.prototype.isElementClass=function(){return this.mode===p},e.prototype.isElementStyle=function(){return this.mode===d},e.prototype.isTextNode=function(){return this.mode===f},e}();t.BindingTarget=m;var v=function(){function e(e,t,r,n,i,o,a){this.mode=e,this.target=t,this.implicitReceiver=r,this.ast=n,this.setter=i,this.lifecycleEvent=o,this.directiveRecord=a}return e.prototype.isDirectiveLifecycle=function(){return this.mode===a},e.prototype.callOnChanges=function(){return o.isPresent(this.directiveRecord)&&this.directiveRecord.callOnChanges},e.prototype.isDefaultChangeDetection=function(){return o.isBlank(this.directiveRecord)||this.directiveRecord.isDefaultChangeDetection()},e.createDirectiveDoCheck=function(t){return new e(a,null,0,null,null,"DoCheck",t)},e.createDirectiveOnInit=function(t){return new e(a,null,0,null,null,"OnInit",t)},e.createDirectiveOnChanges=function(t){return new e(a,null,0,null,null,"OnChanges",t)},e.createForDirective=function(t,r,n,i){var o=i.directiveIndex.elementIndex,a=new m(c,o,r,null,t.toString());return new e(c,a,0,t,n,null,i)},e.createForElementProperty=function(t,r,n){var i=new m(l,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementAttribute=function(t,r,n){var i=new m(u,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementClass=function(t,r,n){var i=new m(p,r,n,null,t.toString());return new e(s,i,0,t,null,null,null)},e.createForElementStyle=function(t,r,n,i){var o=new m(d,r,n,i,t.toString());return new e(s,o,0,t,null,null,null)},e.createForHostProperty=function(t,r,n){var i=new m(l,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostAttribute=function(t,r,n){var i=new m(u,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostClass=function(t,r,n){var i=new m(p,t.elementIndex,n,null,r.toString());return new e(s,i,t,r,null,null,null)},e.createForHostStyle=function(t,r,n,i){var o=new m(d,t.elementIndex,n,i,r.toString());return new e(s,o,t,r,null,null,null)},e.createForTextNode=function(t,r){var n=new m(f,r,null,null,t.toString());return new e(s,n,0,t,null,null,null)},e.createForEvent=function(t,r,n){var i=new m(h,n,r,null,t.toString());return new e(h,i,0,t,null,null,null)},e.createForHostEvent=function(t,r,n){var i=n.directiveIndex,o=new m(g,i.elementIndex,r,null,t.toString());return new e(g,o,i,t,null,null,n)},e}();return t.BindingRecord=v,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/directive_record",["angular2/src/core/facade/lang","angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/change_detection/constants"),s=function(){function e(e,t){this.elementIndex=e,this.directiveIndex=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.elementIndex+"_"+this.directiveIndex},enumerable:!0,configurable:!0}),e}();t.DirectiveIndex=s;var c=function(){function e(e){var t=void 0===e?{}:e,r=t.directiveIndex,n=t.callAfterContentInit,i=t.callAfterContentChecked,a=t.callAfterViewInit,s=t.callAfterViewChecked,c=t.callOnChanges,l=t.callDoCheck,u=t.callOnInit,p=t.changeDetection;this.directiveIndex=r,this.callAfterContentInit=o.normalizeBool(n),this.callAfterContentChecked=o.normalizeBool(i),this.callOnChanges=o.normalizeBool(c),this.callAfterViewInit=o.normalizeBool(a),this.callAfterViewChecked=o.normalizeBool(s),this.callDoCheck=o.normalizeBool(l),this.callOnInit=o.normalizeBool(u),this.changeDetection=p}return e.prototype.isDefaultChangeDetection=function(){return a.isDefaultChangeDetectionStrategy(this.changeDetection)},e}();return t.DirectiveRecord=c,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detector_ref",["angular2/src/core/change_detection/constants"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/change_detection/constants"),a=function(){function e(e){this._cd=e}return e.prototype.markForCheck=function(){this._cd.markPathToRootAsCheckOnce()},e.prototype.detach=function(){this._cd.mode=o.ChangeDetectionStrategy.Detached},e.prototype.detectChanges=function(){this._cd.detectChanges()},e.prototype.reattach=function(){this._cd.mode=o.ChangeDetectionStrategy.CheckAlways,this.markForCheck()},e}();return t.ChangeDetectorRef=a,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/exceptions",["angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/exceptions"),s=function(e){function t(t,r,n,i){e.call(this,"Expression '"+t+"' has changed after it was checked. "+("Previous value: '"+r+"'. Current value: '"+n+"'"))}return o(t,e),t}(a.BaseException);t.ExpressionChangedAfterItHasBeenCheckedException=s;var c=function(e){function t(t,r,n,i){e.call(this,r+" in ["+t+"]",r,n,i),this.location=t}return o(t,e),t}(a.WrappedException);t.ChangeDetectionError=c;var l=function(e){function t(){e.call(this,"Attempt to detect changes on a dehydrated detector.")}return o(t,e),t}(a.BaseException);return t.DehydratedException=l,n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_impl",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){var e=d.global.wtf;return e&&(u=e.trace)?(p=u.events,!0):!1}function i(e,t){return void 0===t&&(t=null),p.createScope(e,t)}function o(e,t){return u.leaveScope(e,t),t}function a(e,t){return u.beginTimeRange(e,t)}function s(e){u.endTimeRange(e)}var c=System.global,l=c.define;c.define=void 0;var u,p,d=e("angular2/src/core/facade/lang");return t.detectWTF=n,t.createScope=i,t.leave=o,t.startTimeRange=a,t.endTimeRange=s,c.define=l,r.exports}),System.register("angular2/src/core/change_detection/observable_facade",[],!0,function(e,t,r){function n(e){return!1}var i=System.global,o=i.define;return i.define=void 0,t.isObservable=n,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_name_util",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e){return a.StringWrapper.replaceAll(e,y,"")}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c="alreadyChecked",l="context",u="propertyBindingIndex",p="directiveIndices",d="dispatcher",f="locals",h="mode",g="pipes",m="protos";t.CONTEXT_INDEX=0;var v="this.",y=a.RegExpWrapper.create("\\W","g");t.sanitizeName=n;var _=function(){function e(e,r,i,o){this._records=e,this._eventBindings=r,this._directiveRecords=i,this._utilName=o,this._sanitizedNames=s.ListWrapper.createFixedSize(this._records.length+1),this._sanitizedNames[t.CONTEXT_INDEX]=l;for(var a=0,c=this._records.length;c>a;++a)this._sanitizedNames[a+1]=n(""+this._records[a].name+a);this._sanitizedEventNames=new s.Map;for(var u=0;ua;++a)d.push(n(""+p.records[a].name+a+"_"+u));this._sanitizedEventNames.set(p,d)}}return e.prototype._addFieldPrefix=function(e){return""+v+e},e.prototype.getDispatcherName=function(){return this._addFieldPrefix(d)},e.prototype.getPipesAccessorName=function(){return this._addFieldPrefix(g)},e.prototype.getProtosName=function(){return this._addFieldPrefix(m)},e.prototype.getDirectivesAccessorName=function(){return this._addFieldPrefix(p)},e.prototype.getLocalsAccessorName=function(){return this._addFieldPrefix(f)},e.prototype.getAlreadyCheckedName=function(){return this._addFieldPrefix(c)},e.prototype.getModeName=function(){return this._addFieldPrefix(h)},e.prototype.getPropertyBindingIndex=function(){return this._addFieldPrefix(u)},e.prototype.getLocalName=function(e){return"l_"+this._sanitizedNames[e]},e.prototype.getEventLocalName=function(e,t){return"l_"+s.MapWrapper.get(this._sanitizedEventNames,e)[t]},e.prototype.getChangeName=function(e){return"c_"+this._sanitizedNames[e]},e.prototype.genInitLocals=function(){for(var e=[],r=[],n=0,i=this.getFieldCount();i>n;++n)if(n==t.CONTEXT_INDEX)e.push(this.getLocalName(n)+" = "+this.getFieldName(n));else{var o=this._records[n-1];if(o.argumentToPureFunction){var a=this.getChangeName(n);e.push(this.getLocalName(n)+","+a),r.push(a)}else e.push(""+this.getLocalName(n))}var c=s.ListWrapper.isEmpty(r)?"":s.ListWrapper.join(r,"=")+" = false;";return"var "+s.ListWrapper.join(e,",")+";"+c},e.prototype.genInitEventLocals=function(){var e=this,r=[this.getLocalName(t.CONTEXT_INDEX)+" = "+this.getFieldName(t.CONTEXT_INDEX)];return s.MapWrapper.forEach(this._sanitizedEventNames,function(n,i){for(var o=0;o1?"var "+r.join(",")+";":""},e.prototype.getPreventDefaultAccesor=function(){return"preventDefault"},e.prototype.getFieldCount=function(){return this._sanitizedNames.length},e.prototype.getFieldName=function(e){return this._addFieldPrefix(this._sanitizedNames[e])},e.prototype.getAllFieldNames=function(){for(var e=[],t=0,r=this.getFieldCount();r>t;++t)(0===t||this._records[t-1].shouldBeChecked())&&e.push(this.getFieldName(t));for(var n=0,i=this._records.length;i>n;++n){var o=this._records[n];o.isPipeRecord()&&e.push(this.getPipeName(o.selfIndex))}for(var a=0,s=this._directiveRecords.length;s>a;++a){var c=this._directiveRecords[a];e.push(this.getDirectiveName(c.directiveIndex)),c.isDefaultChangeDetection()||e.push(this.getDetectorName(c.directiveIndex))}return e},e.prototype.genDehydrateFields=function(){var e=this.getAllFieldNames();return s.ListWrapper.removeAt(e,t.CONTEXT_INDEX),s.ListWrapper.isEmpty(e)?"":(e.push(this._utilName+".uninitialized;"),s.ListWrapper.join(e," = "))},e.prototype.genPipeOnDestroy=function(){var e=this;return s.ListWrapper.join(s.ListWrapper.map(s.ListWrapper.filter(this._records,function(e){return e.isPipeRecord()}),function(t){return e._utilName+".callPipeOnDestroy("+e.getPipeName(t.selfIndex)+");"}),"\n")},e.prototype.getPipeName=function(e){return this._addFieldPrefix(this._sanitizedNames[e]+"_pipe")},e.prototype.getDirectiveName=function(e){return this._addFieldPrefix("directive_"+e.name)},e.prototype.getDetectorName=function(e){return this._addFieldPrefix("detector_"+e.name)},e}();return t.CodegenNameUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_facade",[],!0,function(e,t,r){function n(e){return JSON.stringify(e)}function i(e){return"'"+e+"'"}function o(e){return e.join(" + ")}var a=System.global,s=a.define;return a.define=void 0,t.codify=n,t.rawString=i,t.combineGeneratedStrings=o,a.define=s,r.exports}),System.register("angular2/src/core/change_detection/proto_record",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.Self=0]="Self",e[e.Const=1]="Const",e[e.PrimitiveOp=2]="PrimitiveOp",e[e.PropertyRead=3]="PropertyRead",e[e.PropertyWrite=4]="PropertyWrite",e[e.Local=5]="Local",e[e.InvokeMethod=6]="InvokeMethod",e[e.InvokeClosure=7]="InvokeClosure",e[e.KeyedRead=8]="KeyedRead",e[e.KeyedWrite=9]="KeyedWrite",e[e.Pipe=10]="Pipe",e[e.Interpolate=11]="Interpolate",e[e.SafeProperty=12]="SafeProperty",e[e.CollectionLiteral=13]="CollectionLiteral",e[e.SafeMethodInvoke=14]="SafeMethodInvoke",e[e.DirectiveLifecycle=15]="DirectiveLifecycle",e[e.Chain=16]="Chain"}(t.RecordType||(t.RecordType={}));var o=t.RecordType,a=function(){function e(e,t,r,n,i,o,a,s,c,l,u,p,d,f){this.mode=e,this.name=t,this.funcOrValue=r,this.args=n,this.fixedArgs=i,this.contextIndex=o,this.directiveIndex=a,this.selfIndex=s,this.bindingRecord=c,this.lastInBinding=l,this.lastInDirective=u,this.argumentToPureFunction=p,this.referencedBySelf=d,this.propertyBindingIndex=f}return e.prototype.isPureFunction=function(){return this.mode===o.Interpolate||this.mode===o.CollectionLiteral},e.prototype.isUsedByOtherRecord=function(){return!this.lastInBinding||this.referencedBySelf},e.prototype.shouldBeChecked=function(){return this.argumentToPureFunction||this.lastInBinding||this.isPureFunction()||this.isPipeRecord()},e.prototype.isPipeRecord=function(){return this.mode===o.Pipe},e.prototype.isLifeCycleRecord=function(){return this.mode===o.DirectiveLifecycle},e}();return t.ProtoRecord=a,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/ast",["angular2/src/core/facade/lang","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=function(){function e(){}return e.prototype.visit=function(e){return null},e.prototype.toString=function(){return"AST"},e}();t.AST=c;var l=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){},t}(c);t.EmptyExpr=l;var u=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.visit=function(e){return e.visitImplicitReceiver(this)},t}(c);t.ImplicitReceiver=u;var p=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitChain(this)},t}(c);t.Chain=p;var d=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitConditional(this)},t}(c);t.Conditional=d;var f=function(e){function t(t,r,n){e.call(this),this.condition=t,this.trueExp=r,this.falseExp=n}return o(t,e),t.prototype.visit=function(e){return e.visitIf(this)},t}(c);t.If=f;var h=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyRead(this)},t}(c);t.PropertyRead=h;var g=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.setter=n,this.value=i}return o(t,e),t.prototype.visit=function(e){return e.visitPropertyWrite(this)},t}(c);t.PropertyWrite=g;var m=function(e){function t(t,r,n){e.call(this),this.receiver=t,this.name=r,this.getter=n}return o(t,e),t.prototype.visit=function(e){return e.visitSafePropertyRead(this)},t}(c);t.SafePropertyRead=m;var v=function(e){function t(t,r){e.call(this),this.obj=t,this.key=r}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedRead(this)},t}(c);t.KeyedRead=v;var y=function(e){function t(t,r,n){e.call(this),this.obj=t,this.key=r,this.value=n}return o(t,e),t.prototype.visit=function(e){return e.visitKeyedWrite(this)},t}(c);t.KeyedWrite=y;var _=function(e){function t(t,r,n){e.call(this),this.exp=t,this.name=r,this.args=n}return o(t,e),t.prototype.visit=function(e){return e.visitPipe(this)},t}(c);t.BindingPipe=_;var b=function(e){function t(t){e.call(this),this.value=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralPrimitive(this)},t}(c);t.LiteralPrimitive=b;var w=function(e){function t(t){e.call(this),this.expressions=t}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralArray(this)},t}(c);t.LiteralArray=w;var C=function(e){function t(t,r){e.call(this),this.keys=t,this.values=r}return o(t,e),t.prototype.visit=function(e){return e.visitLiteralMap(this)},t}(c);t.LiteralMap=C;var R=function(e){function t(t,r){e.call(this),this.strings=t,this.expressions=r}return o(t,e),t.prototype.visit=function(e){e.visitInterpolation(this)},t}(c);t.Interpolation=R;var E=function(e){function t(t,r,n){e.call(this),this.operation=t,this.left=r,this.right=n}return o(t,e),t.prototype.visit=function(e){return e.visitBinary(this)},t}(c);t.Binary=E;var P=function(e){function t(t){e.call(this),this.expression=t}return o(t,e),t.prototype.visit=function(e){return e.visitPrefixNot(this)},t}(c);t.PrefixNot=P;var x=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitMethodCall(this)},t}(c);t.MethodCall=x;var S=function(e){function t(t,r,n,i){e.call(this),this.receiver=t,this.name=r,this.fn=n,this.args=i}return o(t,e),t.prototype.visit=function(e){return e.visitSafeMethodCall(this)},t}(c);t.SafeMethodCall=S;var D=function(e){function t(t,r){e.call(this),this.target=t,this.args=r}return o(t,e),t.prototype.visit=function(e){return e.visitFunctionCall(this)},t}(c);t.FunctionCall=D;var I=function(e){function t(t,r,n){e.call(this),this.ast=t,this.source=r,this.location=n}return o(t,e),t.prototype.visit=function(e){return this.ast.visit(e)},t.prototype.toString=function(){return this.source+" in "+this.location},t}(c);t.ASTWithSource=I;var O=function(){function e(e,t,r,n){this.key=e,this.keyIsVar=t,this.name=r,this.expression=n}return e}();t.TemplateBinding=O;var M=function(){function e(){}return e.prototype.visitBinary=function(e){return e.left.visit(this),e.right.visit(this),null},e.prototype.visitChain=function(e){return this.visitAll(e.expressions)},e.prototype.visitConditional=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitIf=function(e){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null},e.prototype.visitPipe=function(e){return e.exp.visit(this),this.visitAll(e.args),null},e.prototype.visitFunctionCall=function(e){return e.target.visit(this),this.visitAll(e.args),null},e.prototype.visitImplicitReceiver=function(e){return null},e.prototype.visitInterpolation=function(e){return this.visitAll(e.expressions)},e.prototype.visitKeyedRead=function(e){return e.obj.visit(this),e.key.visit(this),null},e.prototype.visitKeyedWrite=function(e){return e.obj.visit(this),e.key.visit(this),e.value.visit(this),null},e.prototype.visitLiteralArray=function(e){return this.visitAll(e.expressions)},e.prototype.visitLiteralMap=function(e){return this.visitAll(e.values)},e.prototype.visitLiteralPrimitive=function(e){return null},e.prototype.visitMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitPrefixNot=function(e){return e.expression.visit(this),null},e.prototype.visitPropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitPropertyWrite=function(e){return e.receiver.visit(this),e.value.visit(this),null},e.prototype.visitSafePropertyRead=function(e){return e.receiver.visit(this),null},e.prototype.visitSafeMethodCall=function(e){return e.receiver.visit(this),this.visitAll(e.args)},e.prototype.visitAll=function(e){var t=this;return s.ListWrapper.forEach(e,function(e){e.visit(t)}),null},e}();t.RecursiveAstVisitor=M;var A=function(){function e(){}return e.prototype.visitImplicitReceiver=function(e){return e},e.prototype.visitInterpolation=function(e){return new R(e.strings,this.visitAll(e.expressions))},e.prototype.visitLiteralPrimitive=function(e){return new b(e.value)},e.prototype.visitPropertyRead=function(e){return new h(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitPropertyWrite=function(e){return new g(e.receiver.visit(this),e.name,e.setter,e.value)},e.prototype.visitSafePropertyRead=function(e){return new m(e.receiver.visit(this),e.name,e.getter)},e.prototype.visitMethodCall=function(e){return new x(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitSafeMethodCall=function(e){return new S(e.receiver.visit(this),e.name,e.fn,this.visitAll(e.args))},e.prototype.visitFunctionCall=function(e){return new D(e.target.visit(this),this.visitAll(e.args))},e.prototype.visitLiteralArray=function(e){return new w(this.visitAll(e.expressions))},e.prototype.visitLiteralMap=function(e){return new C(e.keys,this.visitAll(e.values))},e.prototype.visitBinary=function(e){return new E(e.operation,e.left.visit(this),e.right.visit(this))},e.prototype.visitPrefixNot=function(e){return new P(e.expression.visit(this))},e.prototype.visitConditional=function(e){return new d(e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))},e.prototype.visitPipe=function(e){return new _(e.exp.visit(this),e.name,this.visitAll(e.args))},e.prototype.visitKeyedRead=function(e){return new v(e.obj.visit(this),e.key.visit(this))},e.prototype.visitKeyedWrite=function(e){return new y(e.obj.visit(this),e.key.visit(this),e.value.visit(this))},e.prototype.visitAll=function(e){for(var t=s.ListWrapper.createFixedSize(e.length),r=0;r=0;--t){var r=e[t];r.callAfterContentInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterContentInit(),r.callAfterContentChecked&&this._getDirectiveFor(r.directiveIndex).afterContentChecked()}},t.prototype.afterViewLifecycleCallbacksInternal=function(){for(var e=this._directiveRecords,t=e.length-1;t>=0;--t){var r=e[t];r.callAfterViewInit&&!this.alreadyChecked&&this._getDirectiveFor(r.directiveIndex).afterViewInit(), +r.callAfterViewChecked&&this._getDirectiveFor(r.directiveIndex).afterViewChecked()}},t.prototype._updateDirectiveOrElement=function(t,r){if(s.isBlank(r.directiveRecord))e.prototype.notifyDispatcher.call(this,t.currentValue);else{var n=r.directiveRecord.directiveIndex;r.setter(this._getDirectiveFor(n),t.currentValue)}this._genConfig.logBindingUpdate&&e.prototype.logBindingUpdate.call(this,t.currentValue)},t.prototype._addChange=function(t,r,n){return t.callOnChanges()?e.prototype.addChange.call(this,n,r.previousValue,r.currentValue):n},t.prototype._getDirectiveFor=function(e){return this.directives.getDirectiveFor(e)},t.prototype._getDetectorFor=function(e){return this.directives.getDetectorFor(e)},t.prototype._check=function(e,t,r,n){return e.isPipeRecord()?this._pipeCheck(e,t,r):this._referenceCheck(e,t,r,n)},t.prototype._referenceCheck=function(t,r,i,o){if(this._pureFuncAndArgsDidNotChange(t))return this._setChanged(t,!1),null;var a=this._calculateCurrValue(t,i,o);if(this.strategy===d.ChangeDetectionStrategy.OnPushObserve&&e.prototype.observeValue.call(this,a,t.selfIndex),t.shouldBeChecked()){var s=this._readSelf(t,i);if(n(s,a))return this._setChanged(t,!1),null;if(t.lastInBinding){var c=p.ChangeDetectionUtil.simpleChange(s,a);return r&&this.throwOnChangeError(s,a),this._writeSelf(t,a,i),this._setChanged(t,!0),c}return this._writeSelf(t,a,i),this._setChanged(t,!0),null}return this._writeSelf(t,a,i),this._setChanged(t,!0),null},t.prototype._calculateCurrValue=function(e,t,r){switch(e.mode){case f.RecordType.Self:return this._readContext(e,t);case f.RecordType.Const:return e.funcOrValue;case f.RecordType.PropertyRead:var n=this._readContext(e,t);return e.funcOrValue(n);case f.RecordType.SafeProperty:var n=this._readContext(e,t);return s.isBlank(n)?null:e.funcOrValue(n);case f.RecordType.PropertyWrite:var n=this._readContext(e,t),i=this._readArgs(e,t)[0];return e.funcOrValue(n,i),i;case f.RecordType.KeyedWrite:var n=this._readContext(e,t),o=this._readArgs(e,t)[0],i=this._readArgs(e,t)[1];return n[o]=i,i;case f.RecordType.Local:return r.get(e.name);case f.RecordType.InvokeMethod:var n=this._readContext(e,t),a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.SafeMethodInvoke:var n=this._readContext(e,t);if(s.isBlank(n))return null;var a=this._readArgs(e,t);return e.funcOrValue(n,a);case f.RecordType.KeyedRead:var l=this._readArgs(e,t)[0];return this._readContext(e,t)[l];case f.RecordType.Chain:var a=this._readArgs(e,t);return a[a.length-1];case f.RecordType.InvokeClosure:return s.FunctionWrapper.apply(this._readContext(e,t),this._readArgs(e,t));case f.RecordType.Interpolate:case f.RecordType.PrimitiveOp:case f.RecordType.CollectionLiteral:return s.FunctionWrapper.apply(e.funcOrValue,this._readArgs(e,t));default:throw new c.BaseException("Unknown operation "+e.mode)}},t.prototype._pipeCheck=function(e,t,r){var i=this._readContext(e,r),o=this._pipeFor(e,i);if(!o.pure||this._argsOrContextChanged(e)){var a=this._readArgs(e,r),s=o.pipe.transform(i,a);if(e.shouldBeChecked()){var c=this._readSelf(e,r);if(n(c,s))return this._setChanged(e,!1),null;if(s=p.ChangeDetectionUtil.unwrapValue(s),e.lastInBinding){var l=p.ChangeDetectionUtil.simpleChange(c,s);return t&&this.throwOnChangeError(c,s),this._writeSelf(e,s,r),this._setChanged(e,!0),l}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}return this._writeSelf(e,s,r),this._setChanged(e,!0),null}},t.prototype._pipeFor=function(e,t){var r=this._readPipe(e);if(s.isPresent(r))return r;var n=this.pipes.get(e.name);return this._writePipe(e,n),n},t.prototype._readContext=function(e,t){return-1==e.contextIndex?this._getDirectiveFor(e.directiveIndex):t[e.contextIndex]},t.prototype._readSelf=function(e,t){return t[e.selfIndex]},t.prototype._writeSelf=function(e,t,r){r[e.selfIndex]=t},t.prototype._readPipe=function(e){return this.localPipes[e.selfIndex]},t.prototype._writePipe=function(e,t){this.localPipes[e.selfIndex]=t},t.prototype._setChanged=function(e,t){e.argumentToPureFunction&&(this.changes[e.selfIndex]=t)},t.prototype._pureFuncAndArgsDidNotChange=function(e){return e.isPureFunction()&&!this._argsChanged(e)},t.prototype._argsChanged=function(e){for(var t=e.args,r=0;r"+u.stringify(this.currentIndex)+"]"},e}();t.CollectionChangeRecord=f;var h=function(){function e(){this._head=null,this._tail=null}return e.prototype.add=function(e){null===this._head?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)},e.prototype.get=function(e,t){var r;for(r=this._head;null!==r;r=r._nextDup)if((null===t||t"+c.stringify(this.currentValue)+"]"},e}();return t.KVChangeRecord=d,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/interfaces",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=function(){function e(){}return e.prototype.getProtoChangeDetector=function(e,t){return null},Object.defineProperty(e.prototype,"generateDetectors",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"genConfig",{get:function(){return null},enumerable:!0,configurable:!0}),e=o([s.CONST(),a("design:paramtypes",[])],e)}();t.ChangeDetection=c;var l=function(){function e(e,t,r,n,i,o){this.element=e,this.componentElement=t,this.directive=r,this.context=n,this.locals=i,this.injector=o}return e}();t.DebugContext=l;var u=function(){function e(e,t,r,n){this.genCheckNoChanges=e,this.genDebugInfo=t,this.logBindingUpdate=r,this.useJit=n}return e}();t.ChangeDetectorGenConfig=u;var p=function(){function e(e,t,r,n,i,o,a){this.id=e,this.strategy=t,this.variableNames=r,this.bindingRecords=n,this.eventRecords=i,this.directiveRecords=o,this.genConfig=a}return e}();return t.ChangeDetectorDefinition=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/parser/lexer",["angular2/src/core/di/decorators","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions"],!0,function(e,t,r){function n(e,t){return new S(e,P.Character,t,R.StringWrapper.fromCharCode(t))}function i(e,t){return new S(e,P.Identifier,0,t)}function o(e,t){return new S(e,P.Keyword,0,t)}function a(e,t){return new S(e,P.Operator,0,t)}function s(e,t){return new S(e,P.String,0,t)}function c(e,t){return new S(e,P.Number,t,"")}function l(e){return e>=t.$TAB&&e<=t.$SPACE||e==q}function u(e){return e>=B&&U>=e||e>=O&&A>=e||e==N||e==t.$$}function p(e){return e>=B&&U>=e||e>=O&&A>=e||e>=D&&I>=e||e==N||e==t.$$}function d(e){return e>=D&&I>=e}function f(e){return e==k||e==M}function h(e){return e==t.$MINUS||e==t.$PLUS}function g(e){switch(e){case j:return t.$LF;case V:return t.$FF;case L:return t.$CR;case W:return t.$TAB;case H:return t.$VTAB;default:return e}}var m=System.global,v=m.define;m.define=void 0;var y=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},_=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},b=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},w=e("angular2/src/core/di/decorators"),C=e("angular2/src/core/facade/collection"),R=e("angular2/src/core/facade/lang"),E=e("angular2/src/core/facade/exceptions");!function(e){e[e.Character=0]="Character",e[e.Identifier=1]="Identifier",e[e.Keyword=2]="Keyword",e[e.String=3]="String",e[e.Operator=4]="Operator",e[e.Number=5]="Number"}(t.TokenType||(t.TokenType={}));var P=t.TokenType,x=function(){function e(){}return e.prototype.tokenize=function(e){for(var t=new G(e),r=[],n=t.scanToken();null!=n;)r.push(n),n=t.scanToken();return r},e=_([w.Injectable(),b("design:paramtypes",[])],e)}();t.Lexer=x;var S=function(){function e(e,t,r,n){this.index=e,this.type=t,this.numValue=r,this.strValue=n}return e.prototype.isCharacter=function(e){return this.type==P.Character&&this.numValue==e},e.prototype.isNumber=function(){return this.type==P.Number},e.prototype.isString=function(){return this.type==P.String},e.prototype.isOperator=function(e){return this.type==P.Operator&&this.strValue==e},e.prototype.isIdentifier=function(){return this.type==P.Identifier},e.prototype.isKeyword=function(){return this.type==P.Keyword},e.prototype.isKeywordVar=function(){return this.type==P.Keyword&&"var"==this.strValue},e.prototype.isKeywordNull=function(){return this.type==P.Keyword&&"null"==this.strValue},e.prototype.isKeywordUndefined=function(){return this.type==P.Keyword&&"undefined"==this.strValue},e.prototype.isKeywordTrue=function(){return this.type==P.Keyword&&"true"==this.strValue},e.prototype.isKeywordIf=function(){return this.type==P.Keyword&&"if"==this.strValue},e.prototype.isKeywordElse=function(){return this.type==P.Keyword&&"else"==this.strValue},e.prototype.isKeywordFalse=function(){return this.type==P.Keyword&&"false"==this.strValue},e.prototype.toNumber=function(){return this.type==P.Number?this.numValue:-1},e.prototype.toString=function(){switch(this.type){case P.Character:case P.Identifier:case P.Keyword:case P.Operator:case P.String:return this.strValue;case P.Number:return this.numValue.toString();default:return null}},e}();t.Token=S,t.EOF=new S(-1,P.Character,0,""),t.$EOF=0,t.$TAB=9,t.$LF=10,t.$VTAB=11,t.$FF=12,t.$CR=13,t.$SPACE=32,t.$BANG=33,t.$DQ=34,t.$HASH=35,t.$$=36,t.$PERCENT=37,t.$AMPERSAND=38,t.$SQ=39,t.$LPAREN=40,t.$RPAREN=41,t.$STAR=42,t.$PLUS=43,t.$COMMA=44,t.$MINUS=45,t.$PERIOD=46,t.$SLASH=47,t.$COLON=58,t.$SEMICOLON=59,t.$LT=60,t.$EQ=61,t.$GT=62,t.$QUESTION=63;var D=48,I=57,O=65,M=69,A=90;t.$LBRACKET=91,t.$BACKSLASH=92,t.$RBRACKET=93;var T=94,N=95,B=97,k=101,V=102,j=110,L=114,W=116,F=117,H=118,U=122;t.$LBRACE=123,t.$BAR=124,t.$RBRACE=125;var q=160,K=function(e){function t(t){e.call(this),this.message=t}return y(t,e),t.prototype.toString=function(){return this.message},t}(E.BaseException);t.ScannerError=K;var G=function(){function e(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}return e.prototype.advance=function(){this.peek=++this.index>=this.length?t.$EOF:R.StringWrapper.charCodeAt(this.input,this.index)},e.prototype.scanToken=function(){for(var e=this.input,r=this.length,i=this.peek,o=this.index;i<=t.$SPACE;){if(++o>=r){i=t.$EOF;break}i=R.StringWrapper.charCodeAt(e,o)}if(this.peek=i,this.index=o,o>=r)return null;if(u(i))return this.scanIdentifier();if(d(i))return this.scanNumber(o);var a=o;switch(i){case t.$PERIOD:return this.advance(),d(this.peek)?this.scanNumber(a):n(a,t.$PERIOD);case t.$LPAREN:case t.$RPAREN:case t.$LBRACE:case t.$RBRACE:case t.$LBRACKET:case t.$RBRACKET:case t.$COMMA:case t.$COLON:case t.$SEMICOLON:return this.scanCharacter(a,i);case t.$SQ:case t.$DQ:return this.scanString(); + +case t.$HASH:case t.$PLUS:case t.$MINUS:case t.$STAR:case t.$SLASH:case t.$PERCENT:case T:return this.scanOperator(a,R.StringWrapper.fromCharCode(i));case t.$QUESTION:return this.scanComplexOperator(a,"?",t.$PERIOD,".");case t.$LT:case t.$GT:return this.scanComplexOperator(a,R.StringWrapper.fromCharCode(i),t.$EQ,"=");case t.$BANG:case t.$EQ:return this.scanComplexOperator(a,R.StringWrapper.fromCharCode(i),t.$EQ,"=",t.$EQ,"=");case t.$AMPERSAND:return this.scanComplexOperator(a,"&",t.$AMPERSAND,"&");case t.$BAR:return this.scanComplexOperator(a,"|",t.$BAR,"|");case q:for(;l(this.peek);)this.advance();return this.scanToken()}return this.error("Unexpected character ["+R.StringWrapper.fromCharCode(i)+"]",0),null},e.prototype.scanCharacter=function(e,t){return assert(this.peek==t),this.advance(),n(e,t)},e.prototype.scanOperator=function(e,t){return assert(this.peek==R.StringWrapper.charCodeAt(t,0)),assert(C.SetWrapper.has(z,t)),this.advance(),a(e,t)},e.prototype.scanComplexOperator=function(e,t,r,n,i,o){assert(this.peek==R.StringWrapper.charCodeAt(t,0)),this.advance();var s=t;return this.peek==r&&(this.advance(),s+=n),R.isPresent(i)&&this.peek==i&&(this.advance(),s+=o),assert(C.SetWrapper.has(z,s)),a(e,s)},e.prototype.scanIdentifier=function(){assert(u(this.peek));var e=this.index;for(this.advance();p(this.peek);)this.advance();var t=this.input.substring(e,this.index);return C.SetWrapper.has($,t)?o(e,t):i(e,t)},e.prototype.scanNumber=function(e){assert(d(this.peek));var r=this.index===e;for(this.advance();;){if(d(this.peek));else if(this.peek==t.$PERIOD)r=!1;else{if(!f(this.peek))break;this.advance(),h(this.peek)&&this.advance(),d(this.peek)||this.error("Invalid exponent",-1),r=!1}this.advance()}var n=this.input.substring(e,this.index),i=r?R.NumberWrapper.parseIntAutoRadix(n):R.NumberWrapper.parseFloat(n);return c(e,i)},e.prototype.scanString=function(){assert(this.peek==t.$SQ||this.peek==t.$DQ);var e=this.index,r=this.peek;this.advance();for(var n,i=this.index,o=this.input;this.peek!=r;)if(this.peek==t.$BACKSLASH){null==n&&(n=new R.StringJoiner),n.add(o.substring(i,this.index)),this.advance();var a;if(this.peek==F){var c=o.substring(this.index+1,this.index+5);try{a=R.NumberWrapper.parseInt(c,16)}catch(l){this.error("Invalid unicode escape [\\u"+c+"]",0)}for(var u=0;5>u;u++)this.advance()}else a=g(this.peek),this.advance();n.add(R.StringWrapper.fromCharCode(a)),i=this.index}else this.peek==t.$EOF?this.error("Unterminated quote",0):this.advance();var p=o.substring(i,this.index);this.advance();var d=p;return null!=n&&(n.add(p),d=n.toString()),s(e,d)},e.prototype.error=function(e,t){var r=this.index+t;throw new K("Lexer Error: "+e+" at column "+r+" in expression ["+this.input+"]")},e}(),z=C.SetWrapper.createFromList(["+","-","*","/","%","^","=","==","!=","===","!==","<",">","<=",">=","&&","||","&","|","!","?","#","?."]),$=C.SetWrapper.createFromList(["var","null","undefined","true","false","if","else"]);return m.define=v,r.exports}),System.register("angular2/src/core/change_detection/parser/parser",["angular2/src/core/di/decorators","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/lexer","angular2/src/core/reflection/reflection","angular2/src/core/change_detection/parser/ast"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di/decorators"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/change_detection/parser/lexer"),f=e("angular2/src/core/reflection/reflection"),h=e("angular2/src/core/change_detection/parser/ast"),g=new h.ImplicitReceiver,m=/\{\{(.*?)\}\}/g,v=function(e){function t(t,r,n,i){e.call(this,"Parser Error: "+t+" "+n+" ["+r+"] in "+i)}return o(t,e),t}(u.BaseException),y=function(){function e(e,t){void 0===t&&(t=null),this._lexer=e,this._reflector=l.isPresent(t)?t:f.reflector}return e.prototype.parseAction=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!0).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseChain();return new h.ASTWithSource(n,e,t)},e.prototype.parseSimpleBinding=function(e,t){this._checkNoInterpolation(e,t);var r=this._lexer.tokenize(e),n=new _(e,t,r,this._reflector,!1).parseSimpleBinding();return new h.ASTWithSource(n,e,t)},e.prototype.parseTemplateBindings=function(e,t){var r=this._lexer.tokenize(e);return new _(e,t,r,this._reflector,!1).parseTemplateBindings()},e.prototype.parseInterpolation=function(e,t){var r=l.StringWrapper.split(e,m);if(r.length<=1)return null;for(var n=[],i=[],o=0;o0))throw new v("Blank expressions are not allowed in interpolated strings",e,"at column "+this._findInterpolationErrorColumn(r,o)+" in",t);var s=this._lexer.tokenize(a),c=new _(e,t,s,this._reflector,!1).parseChain();i.push(c)}}return new h.ASTWithSource(new h.Interpolation(n,i),e,t)},e.prototype.wrapLiteralPrimitive=function(e,t){return new h.ASTWithSource(new h.LiteralPrimitive(e),e,t)},e.prototype._checkNoInterpolation=function(e,t){var r=l.StringWrapper.split(e,m);if(r.length>1)throw new v("Got interpolation ({{}}) where expression was expected",e,"at column "+this._findInterpolationErrorColumn(r,1)+" in",t)},e.prototype._findInterpolationErrorColumn=function(e,t){for(var r="",n=0;t>n;n++)r+=n%2===0?e[n]:"{{"+e[n]+"}}";return r.length},e=a([c.Injectable(),s("design:paramtypes",[d.Lexer,f.Reflector])],e)}();t.Parser=y;var _=function(){function e(e,t,r,n,i){this.input=e,this.location=t,this.tokens=r,this.reflector=n,this.parseAction=i,this.index=0}return e.prototype.peek=function(e){var t=this.index+e;return t"))e=new h.Binary(">",e,this.parseAdditive());else if(this.optionalOperator("<="))e=new h.Binary("<=",e,this.parseAdditive());else{if(!this.optionalOperator(">="))return e;e=new h.Binary(">=",e,this.parseAdditive())}},e.prototype.parseAdditive=function(){for(var e=this.parseMultiplicative();;)if(this.optionalOperator("+"))e=new h.Binary("+",e,this.parseMultiplicative());else{if(!this.optionalOperator("-"))return e;e=new h.Binary("-",e,this.parseMultiplicative())}},e.prototype.parseMultiplicative=function(){for(var e=this.parsePrefix();;)if(this.optionalOperator("*"))e=new h.Binary("*",e,this.parsePrefix());else if(this.optionalOperator("%"))e=new h.Binary("%",e,this.parsePrefix());else{if(!this.optionalOperator("/"))return e;e=new h.Binary("/",e,this.parsePrefix())}},e.prototype.parsePrefix=function(){return this.optionalOperator("+")?this.parsePrefix():this.optionalOperator("-")?new h.Binary("-",new h.LiteralPrimitive(0),this.parsePrefix()):this.optionalOperator("!")?new h.PrefixNot(this.parsePrefix()):this.parseCallChain()},e.prototype.parseCallChain=function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(d.$PERIOD))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(d.$LBRACKET)){var t=this.parsePipe();if(this.expectCharacter(d.$RBRACKET),this.optionalOperator("=")){var r=this.parseConditional();e=new h.KeyedWrite(e,t,r)}else e=new h.KeyedRead(e,t)}else{if(!this.optionalCharacter(d.$LPAREN))return e;var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN),e=new h.FunctionCall(e,n)}},e.prototype.parsePrimary=function(){if(this.optionalCharacter(d.$LPAREN)){var e=this.parsePipe();return this.expectCharacter(d.$RPAREN),e}if(this.next.isKeywordNull()||this.next.isKeywordUndefined())return this.advance(),new h.LiteralPrimitive(null);if(this.next.isKeywordTrue())return this.advance(),new h.LiteralPrimitive(!0);if(this.next.isKeywordFalse())return this.advance(),new h.LiteralPrimitive(!1);if(this.parseAction&&this.next.isKeywordIf()){this.advance(),this.expectCharacter(d.$LPAREN);var t=this.parseExpression();this.expectCharacter(d.$RPAREN);var r,n=this.parseExpressionOrBlock();return this.next.isKeywordElse()&&(this.advance(),r=this.parseExpressionOrBlock()),new h.If(t,n,r)}if(this.optionalCharacter(d.$LBRACKET)){var i=this.parseExpressionList(d.$RBRACKET);return this.expectCharacter(d.$RBRACKET),new h.LiteralArray(i)}if(this.next.isCharacter(d.$LBRACE))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(g,!1);if(this.next.isNumber()){var o=this.next.toNumber();return this.advance(),new h.LiteralPrimitive(o)}if(this.next.isString()){var a=this.next.toString();return this.advance(),new h.LiteralPrimitive(a)}throw this.error(this.index>=this.tokens.length?"Unexpected end of expression: "+this.input:"Unexpected token "+this.next),new u.BaseException("Fell through all cases in parsePrimary")},e.prototype.parseExpressionList=function(e){var t=[];if(!this.next.isCharacter(e))do t.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return t},e.prototype.parseLiteralMap=function(){var e=[],t=[];if(this.expectCharacter(d.$LBRACE),!this.optionalCharacter(d.$RBRACE)){do{var r=this.expectIdentifierOrKeywordOrString();e.push(r),this.expectCharacter(d.$COLON),t.push(this.parsePipe())}while(this.optionalCharacter(d.$COMMA));this.expectCharacter(d.$RBRACE)}return new h.LiteralMap(e,t)},e.prototype.parseAccessMemberOrMethodCall=function(e,t){void 0===t&&(t=!1);var r=this.expectIdentifierOrKeyword();if(this.optionalCharacter(d.$LPAREN)){var n=this.parseCallArguments();this.expectCharacter(d.$RPAREN);var i=this.reflector.method(r);return t?new h.SafeMethodCall(e,r,i,n):new h.MethodCall(e,r,i,n)}if(!t){if(this.optionalOperator("=")){this.parseAction||this.error("Bindings cannot contain assignments");var o=this.parseConditional();return new h.PropertyWrite(e,r,this.reflector.setter(r),o)}return new h.PropertyRead(e,r,this.reflector.getter(r))}return this.optionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),null):new h.SafePropertyRead(e,r,this.reflector.getter(r))},e.prototype.parseCallArguments=function(){if(this.next.isCharacter(d.$RPAREN))return[];var e=[];do e.push(this.parsePipe());while(this.optionalCharacter(d.$COMMA));return e},e.prototype.parseExpressionOrBlock=function(){if(this.optionalCharacter(d.$LBRACE)){var e=this.parseBlockContent();return this.expectCharacter(d.$RBRACE),e}return this.parseExpression()},e.prototype.parseBlockContent=function(){this.parseAction||this.error("Binding expression cannot contain chained expression");for(var e=[];this.indexe?"short":"long"}function o(e){for(var t,r={},o=0;o=3?i(a):n(a);break;case"d":r.day=n(a);break;case"E":r.weekday=i(a);break;case"j":r.hour=n(a);break;case"h":r.hour=n(a),r.hour12=!0;break;case"H":r.hour=n(a),r.hour12=!1;break;case"m":r.minute=n(a);break;case"s":r.second=n(a);break;case"z":r.timeZoneName="long";break;case"Z":r.timeZoneName="short"}o=t}return r}var a=System.global,s=a.define;a.define=void 0,function(e){e[e.Decimal=0]="Decimal",e[e.Percent=1]="Percent",e[e.Currency=2]="Currency"}(t.NumberFormatStyle||(t.NumberFormatStyle={}));var c=t.NumberFormatStyle,l=function(){function e(){}return e.format=function(e,t,r,n){var i=void 0===n?{}:n,o=i.minimumIntegerDigits,a=void 0===o?1:o,s=i.minimumFractionDigits,l=void 0===s?0:s,u=i.maximumFractionDigits,p=void 0===u?3:u,d=i.currency,f=i.currencyAsSymbol,h=void 0===f?!1:f,g={minimumIntegerDigits:a,minimumFractionDigits:l,maximumFractionDigits:p};return g.style=c[r].toLowerCase(),r==c.Currency&&(g.currency=d,g.currencyDisplay=h?"symbol":"code"),new Intl.NumberFormat(t,g).format(e)},e}();t.NumberFormatter=l;var u=new Map,p=function(){function e(){}return e.format=function(e,t,r){var n=t+r;if(u.has(n))return u.get(n).format(e);var i=new Intl.DateTimeFormat(t,o(r));return u.set(n,i),i.format(e)},e}();return t.DateFormatter=p,a.define=s,r.exports}),System.register("angular2/src/core/pipes/uppercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/metadata"),l=e("angular2/src/core/di"),u=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new u.InvalidPipeArgumentException(e,t);return s.StringWrapper.toUpperCase(t)},e=o([s.CONST(),c.Pipe({name:"uppercase"}),l.Injectable(),a("design:paramtypes",[])],e); + +}();return t.UpperCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/lowercase_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),l=e("angular2/src/core/metadata"),u=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),p=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(t))return t;if(!s.isString(t))throw new u.InvalidPipeArgumentException(e,t);return s.StringWrapper.toLowerCase(t)},e=o([s.CONST(),l.Pipe({name:"lowercase"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.LowerCasePipe=p,n.define=i,r.exports}),System.register("angular2/src/core/pipes/json_pipe",["angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/di"),l=e("angular2/src/core/metadata"),u=function(){function e(){}return e.prototype.transform=function(e,t){return void 0===t&&(t=null),s.Json.stringify(e)},e=o([s.CONST(),l.Pipe({name:"json"}),c.Injectable(),a("design:paramtypes",[])],e)}();return t.JsonPipe=u,n.define=i,r.exports}),System.register("angular2/src/core/pipes/slice_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/di","angular2/src/core/pipes/invalid_pipe_argument_exception","angular2/src/core/metadata"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/facade/exceptions"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/di"),p=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),d=e("angular2/src/core/metadata"),f=function(){function e(){}return e.prototype.transform=function(t,r){if(void 0===r&&(r=null),s.isBlank(r)||0==r.length)throw new c.BaseException("Slice pipe requires one argument");if(!this.supports(t))throw new p.InvalidPipeArgumentException(e,t);if(s.isBlank(t))return t;var n=r[0],i=r.length>1?r[1]:null;return s.isString(t)?s.StringWrapper.slice(t,n,i):l.ListWrapper.slice(t,n,i)},e.prototype.supports=function(e){return s.isString(e)||s.isArray(e)},e=o([d.Pipe({name:"slice"}),u.Injectable(),a("design:paramtypes",[])],e)}();return t.SlicePipe=f,n.define=i,r.exports}),System.register("angular2/src/core/pipes/number_pipe",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/intl","angular2/src/core/di","angular2/src/core/metadata","angular2/src/core/facade/collection","angular2/src/core/pipes/invalid_pipe_argument_exception"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/intl"),p=e("angular2/src/core/di"),d=e("angular2/src/core/metadata"),f=e("angular2/src/core/facade/collection"),h=e("angular2/src/core/pipes/invalid_pipe_argument_exception"),g="en-US",m=c.RegExpWrapper.create("^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$"),v=function(){function e(){}return e._format=function(t,r,n,i,o){if(void 0===i&&(i=null),void 0===o&&(o=!1),c.isBlank(t))return null;if(!c.isNumber(t))throw new h.InvalidPipeArgumentException(e,t);var a=1,s=0,p=3;if(c.isPresent(n)){var d=c.RegExpWrapper.firstMatch(m,n);if(c.isBlank(d))throw new l.BaseException(n+" is not a valid digit info for number pipes");c.isPresent(d[1])&&(a=c.NumberWrapper.parseIntAutoRadix(d[1])),c.isPresent(d[3])&&(s=c.NumberWrapper.parseIntAutoRadix(d[3])),c.isPresent(d[5])&&(p=c.NumberWrapper.parseIntAutoRadix(d[5]))}return u.NumberFormatter.format(t,g,r,{minimumIntegerDigits:a,minimumFractionDigits:s,maximumFractionDigits:p,currency:i,currencyAsSymbol:o})},e=a([c.CONST(),p.Injectable(),s("design:paramtypes",[])],e)}();t.NumberPipe=v;var y=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return v._format(e,u.NumberFormatStyle.Decimal,r)},t=a([c.CONST(),d.Pipe({name:"number"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);t.DecimalPipe=y;var _=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=f.ListWrapper.first(t);return v._format(e,u.NumberFormatStyle.Percent,r)},t=a([c.CONST(),d.Pipe({name:"percent"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);t.PercentPipe=_;var b=function(e){function t(){e.apply(this,arguments)}return o(t,e),t.prototype.transform=function(e,t){var r=c.isPresent(t)&&t.length>0?t[0]:"USD",n=c.isPresent(t)&&t.length>1?t[1]:!1,i=c.isPresent(t)&&t.length>2?t[2]:null;return v._format(e,u.NumberFormatStyle.Currency,i,r,n)},t=a([c.CONST(),d.Pipe({name:"currency"}),p.Injectable(),s("design:paramtypes",[])],t)}(v);return t.CurrencyPipe=b,n.define=i,r.exports}),System.register("angular2/src/core/facade",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.Type=o.Type;var a=e("angular2/src/core/facade/async");t.Observable=a.Observable,t.EventEmitter=a.EventEmitter;var s=e("angular2/src/core/facade/exceptions");return t.WrappedException=s.WrappedException,n.define=i,r.exports}),System.register("angular2/src/core/application_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/lang");return t.APP_COMPONENT_REF_PROMISE=a.CONST_EXPR(new o.OpaqueToken("Promise")),t.APP_COMPONENT=a.CONST_EXPR(new o.OpaqueToken("AppComponent")),n.define=i,r.exports}),System.register("angular2/src/core/forms/validators",["angular2/src/core/facade/lang","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/di");t.NG_VALIDATORS=a.CONST_EXPR(new c.OpaqueToken("NgValidators"));var l=function(){function e(){}return e.required=function(e){return o.isBlank(e.value)||""==e.value?{required:!0}:null},e.nullValidator=function(e){return null},e.compose=function(t){return o.isBlank(t)?e.nullValidator:function(e){var r=s.ListWrapper.reduce(t,function(t,r){var n=r(e);return o.isPresent(n)?s.StringMapWrapper.merge(t,n):t},{});return s.StringMapWrapper.isEmpty(r)?null:r}},e.group=function(t){var r={};return s.StringMapWrapper.forEach(t.controls,function(n,i){t.contains(i)&&o.isPresent(n.errors)&&e._mergeErrors(n,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e.array=function(t){var r={};return t.controls.forEach(function(t){o.isPresent(t.errors)&&e._mergeErrors(t,r)}),s.StringMapWrapper.isEmpty(r)?null:r},e._mergeErrors=function(e,t){s.StringMapWrapper.forEach(e.errors,function(r,n){s.StringMapWrapper.contains(t,n)||(t[n]=[]);var i=t[n];i.push(e)})},e}();return t.Validators=l,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/abstract_control_directive",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return Object.defineProperty(e.prototype,"control",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.control.value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this.control.valid},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this.control.errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return this.control.pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return this.control.dirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return this.control.touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return this.control.untouched},enumerable:!0,configurable:!0}),e}();return t.AbstractControlDirective=o,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/control_container",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments)}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t}(a.AbstractControlDirective);return t.ControlContainer=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control",["angular2/src/core/forms/directives/abstract_control_directive"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/forms/directives/abstract_control_directive"),s=function(e){function t(){e.apply(this,arguments),this.name=null,this.valueAccessor=null}return o(t,e),Object.defineProperty(t.prototype,"validator",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return null},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){},t}(a.AbstractControlDirective);return t.NgControl=s,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/shared",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/forms/validators"],!0,function(e,t,r){function n(e,t){var r=u.ListWrapper.clone(t.path);return r.push(e),r}function i(e,t){p.isBlank(e)&&o(t,"Cannot find control"),p.isBlank(t.valueAccessor)&&o(t,"No value accessor for"),e.validator=f.Validators.compose([e.validator,t.validator]),t.valueAccessor.writeValue(e.value),t.valueAccessor.registerOnChange(function(r){t.viewToModelUpdate(r),e.updateValue(r,{emitModelToViewChange:!1}),e.markAsDirty()}),e.registerOnChange(function(e){return t.valueAccessor.writeValue(e)}),t.valueAccessor.registerOnTouched(function(){return e.markAsTouched()})}function o(e,t){var r=u.ListWrapper.join(e.path," -> ");throw new d.BaseException(t+" '"+r+"'")}function a(e,t,r,n){e.setElementProperty(t,r,n)}function s(e,t){if(!u.StringMapWrapper.contains(e,"model"))return!1;var r=e.model;return r.isFirstChange()?!0:!p.looseIdentical(t,r.currentValue)}var c=System.global,l=c.define;c.define=void 0;var u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/facade/exceptions"),f=e("angular2/src/core/forms/validators");return t.controlPath=n,t.setUpControl=i,t.setProperty=a,t.isPropertyUpdated=s,c.define=l,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_control",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/validators","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/ng_control"),h=e("angular2/src/core/forms/validators"),g=e("angular2/src/core/forms/directives/shared"),m=l.CONST_EXPR(new d.Binding(f.NgControl,{toAlias:d.forwardRef(function(){return v})})),v=function(e){function t(t){e.call(this),this.update=new u.EventEmitter,this._added=!1,this.validators=t}return o(t,e),t.prototype.onChanges=function(e){this._added||(g.setUpControl(this.form,this),this.form.updateValidity(),this._added=!0),g.isPropertyUpdated(e,this.viewModel)&&(this.form.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return h.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-form-control]",bindings:[m],properties:["form: ngFormControl","model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(h.NG_VALIDATORS)),s("design:paramtypes",[Array])],t)}(f.NgControl);return t.NgFormControl=v,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/model","angular2/src/core/forms/validators","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/ng_control"),h=e("angular2/src/core/forms/model"),g=e("angular2/src/core/forms/validators"),m=e("angular2/src/core/forms/directives/shared"),v=l.CONST_EXPR(new d.Binding(f.NgControl,{toAlias:d.forwardRef(function(){return y})})),y=function(e){function t(t){e.call(this),this._control=new h.Control,this._added=!1,this.update=new u.EventEmitter,this.validators=t}return o(t,e),t.prototype.onChanges=function(e){this._added||(m.setUpControl(this._control,this),this._control.updateValidity(),this._added=!0),m.isPropertyUpdated(e,this.viewModel)&&(this._control.updateValue(this.model),this.viewModel=this.model)},Object.defineProperty(t.prototype,"control",{get:function(){return this._control},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return g.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},t=a([p.Directive({selector:"[ng-model]:not([ng-control]):not([ng-form-control])",bindings:[v],properties:["model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Optional()),c(0,d.Inject(g.NG_VALIDATORS)),s("design:paramtypes",[Array])],t)}(f.NgControl);return t.NgModel=y,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_group",["angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/metadata"),u=e("angular2/src/core/di"),p=e("angular2/src/core/facade/lang"),d=e("angular2/src/core/forms/directives/control_container"),f=e("angular2/src/core/forms/directives/shared"),h=p.CONST_EXPR(new u.Binding(d.ControlContainer,{toAlias:u.forwardRef(function(){return g})})),g=function(e){function t(t){e.call(this),this._parent=t}return o(t,e),t.prototype.onInit=function(){this.formDirective.addControlGroup(this)},t.prototype.onDestroy=function(){this.formDirective.removeControlGroup(this)},Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControlGroup(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return f.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),t=a([l.Directive({selector:"[ng-control-group]",bindings:[h],properties:["name: ng-control-group"],exportAs:"form"}),c(0,u.Host()),c(0,u.SkipSelf()),s("design:paramtypes",[d.ControlContainer])],t)}(d.ControlContainer);return t.NgControlGroup=g,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form_model",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/shared"),g=c.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return m})})),m=function(e){function t(){e.apply(this,arguments),this.form=null,this.directives=[],this.ngSubmit=new u.EventEmitter}return o(t,e),t.prototype.onChanges=function(e){this._updateDomValue()},Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this.form.find(e.path);h.setUpControl(t,e),t.updateValidity(),this.directives.push(e)},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){l.ListWrapper.remove(this.directives,e)},t.prototype.addControlGroup=function(e){},t.prototype.removeControlGroup=function(e){},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this.form.find(e.path);r.updateValue(t)},t.prototype.onSubmit=function(){return u.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._updateDomValue=function(){var e=this;l.ListWrapper.forEach(this.directives,function(t){var r=e.form.find(t.path);t.valueAccessor.writeValue(r.value)})},t=a([p.Directive({selector:"[ng-form-model]",bindings:[g],properties:["form: ng-form-model"],host:{"(submit)":"onSubmit()"},events:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgFormModel=m,n.define=i,r.exports}),System.register("angular2/src/core/forms/directives/ng_form",["angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/model","angular2/src/core/forms/directives/shared"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/async"),l=e("angular2/src/core/facade/collection"),u=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/model"),g=e("angular2/src/core/forms/directives/shared"),m=u.CONST_EXPR(new d.Binding(f.ControlContainer,{toAlias:d.forwardRef(function(){return v})})),v=function(e){function t(){e.apply(this,arguments),this.form=new h.ControlGroup({}),this.ngSubmit=new c.EventEmitter}return o(t,e),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.form},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controls",{get:function(){return this.form.controls},enumerable:!0,configurable:!0}),t.prototype.addControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.Control;g.setUpControl(i,e),n.addControl(e.name,i),i.updateValidity()})},t.prototype.getControl=function(e){return this.form.find(e.path)},t.prototype.removeControl=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);u.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.addControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path),i=new h.ControlGroup({});n.addControl(e.name,i),i.updateValidity()})},t.prototype.removeControlGroup=function(e){var t=this;this._later(function(r){var n=t._findContainer(e.path);u.isPresent(n)&&(n.removeControl(e.name),n.updateValidity())})},t.prototype.getControlGroup=function(e){return this.form.find(e.path)},t.prototype.updateModel=function(e,t){var r=this;this._later(function(n){var i=r.form.find(e.path);i.updateValue(t)})},t.prototype.onSubmit=function(){return c.ObservableWrapper.callNext(this.ngSubmit,null),!1},t.prototype._findContainer=function(e){return l.ListWrapper.removeLast(e),l.ListWrapper.isEmpty(e)?this.form:this.form.find(e)},t.prototype._later=function(e){c.PromiseWrapper.then(c.PromiseWrapper.resolve(null),e,function(e){})},t=a([p.Directive({selector:"form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]",bindings:[m],host:{"(submit)":"onSubmit()"},events:["ngSubmit"],exportAs:"form"}),s("design:paramtypes",[])],t)}(f.ControlContainer);return t.NgForm=v,n.define=i,r.exports}),System.register("angular2/src/core/compiler/component_url_mapper",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/di"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/reflection/reflection"),d=function(){function e(){}return e.prototype.getUrl=function(e){return p.reflector.isReflectionEnabled()?p.reflector.importUri(e):"./"},e=a([c.Injectable(),s("design:paramtypes",[])],e)}();t.ComponentUrlMapper=d;var f=function(e){function t(){e.call(this),this._componentUrls=new u.Map}return o(t,e),t.prototype.setComponentUrl=function(e,t){this._componentUrls.set(e,t)},t.prototype.getUrl=function(t){var r=this._componentUrls.get(t);return l.isPresent(r)?r:e.prototype.getUrl.call(this,t)},t}(d);return t.RuntimeComponentUrlMapper=f,n.define=i,r.exports}),System.register("angular2/src/core/compiler/directive_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/metadata","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/reflection/reflection"),f=function(){function e(){}return e.prototype.resolve=function(e){var t=d.reflector.annotations(s.resolveForwardRef(e));if(c.isPresent(t))for(var r=0;r0?l.ListWrapper.removeLast(t):null},e.prototype.returnView=function(e){var t=e.proto,r=this._pooledViewsPerProtoView.get(t);u.isBlank(r)&&(r=[],this._pooledViewsPerProtoView.set(t,r));var n=r.length=0;e--)this.remove(e)},e.prototype.get=function(e){return this._getViews()[e].ref},Object.defineProperty(e.prototype,"length",{get:function(){return this._getViews().length},enumerable:!0,configurable:!0}),e.prototype.createEmbeddedView=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.createEmbeddedViewInContainer(this.element,t,e)},e.prototype.createHostView=function(e,t,r){return void 0===e&&(e=null),void 0===t&&(t=-1),void 0===r&&(r=null),-1==t&&(t=this.length),this.viewManager.createHostViewInContainer(this.element,t,e,r)},e.prototype.insert=function(e,t){return void 0===t&&(t=-1),-1==t&&(t=this.length),this.viewManager.attachViewInContainer(this.element,t,e)},e.prototype.indexOf=function(e){return o.ListWrapper.indexOf(this._getViews(),s.internalView(e))},e.prototype.remove=function(e){void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.destroyViewInContainer(this.element,e)},e.prototype.detach=function(e){return void 0===e&&(e=-1),-1==e&&(e=this.length-1),this.viewManager.detachViewInContainer(this.element,e)},e}();return t.ViewContainerRef=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/interfaces",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0,function(e){e[e.OnInit=0]="OnInit",e[e.OnDestroy=1]="OnDestroy",e[e.DoCheck=2]="DoCheck",e[e.OnChanges=3]="OnChanges",e[e.AfterContentInit=4]="AfterContentInit",e[e.AfterContentChecked=5]="AfterContentChecked",e[e.AfterViewInit=6]="AfterViewInit",e[e.AfterViewChecked=7]="AfterViewChecked"}(t.LifecycleHooks||(t.LifecycleHooks={}));var o=t.LifecycleHooks;return t.LIFECYCLE_HOOKS_VALUES=[o.OnInit,o.OnDestroy,o.DoCheck,o.OnChanges,o.AfterContentInit,o.AfterContentChecked,o.AfterViewInit,o.AfterViewChecked],n.define=i,r.exports}),System.register("angular2/src/core/compiler/query_list",["angular2/src/core/facade/collection","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=function(){function e(){this._results=[],this._callbacks=[],this._dirty=!1}return e.prototype.reset=function(e){this._results=e,this._dirty=!0},e.prototype.add=function(e){this._results.push(e),this._dirty=!0},e.prototype.onChange=function(e){this._callbacks.push(e)},e.prototype.removeCallback=function(e){o.ListWrapper.remove(this._callbacks,e)},e.prototype.removeAllCallbacks=function(){this._callbacks=[]},e.prototype.toString=function(){return this._results.toString()},Object.defineProperty(e.prototype,"length",{get:function(){return this._results.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"first",{get:function(){return o.ListWrapper.first(this._results)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"last",{get:function(){return o.ListWrapper.last(this._results)},enumerable:!0,configurable:!0}),e.prototype.map=function(e){return this._results.map(e)},e.prototype[a.getSymbolIterator()]=function(){return this._results[a.getSymbolIterator()]()},e.prototype.fireCallbacks=function(){this._dirty&&(o.ListWrapper.forEach(this._callbacks,function(e){return e()}),this._dirty=!1)},e}();return t.QueryList=s,n.define=i,r.exports}),System.register("angular2/src/core/render/event_config",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");t.EVENT_TARGET_SEPARATOR=":";var a=function(){function e(e,t,r){this.fieldName=e,this.eventName=t,this.isLongForm=r}return e.parse=function(r){var n=r,i=r,a=!1,s=r.indexOf(t.EVENT_TARGET_SEPARATOR);return s>-1&&(n=o.StringWrapper.substring(r,0,s).trim(),i=o.StringWrapper.substring(r,s+1).trim(),a=!0),new e(n,i,a)},e.prototype.getFullName=function(){return this.isLongForm?""+this.fieldName+t.EVENT_TARGET_SEPARATOR+this.eventName:this.eventName},e}();return t.EventConfig=a,n.define=i,r.exports}),System.register("angular2/src/core/pipes/pipe_binding",["angular2/src/core/di/binding","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/di/binding"),s=e("angular2/src/core/di"),c=function(e){function t(t,r,n,i,o){e.call(this,n,i,o),this.name=t,this.pure=r}return o(t,e),t.createFromType=function(e,r){var n=new s.Binding(e,{toClass:e}),i=a.resolveBinding(n);return new t(r.name,r.pure,i.key,i.resolvedFactories,i.multiBinding)},t}(s.ResolvedBinding);return t.PipeBinding=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/view_resolver",["angular2/src/core/di","angular2/src/core/metadata/view","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/metadata/view"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/reflection/reflection"),f=function(){function e(){this._cache=new p.Map}return e.prototype.resolve=function(e){var t=this._cache.get(e);return l.isBlank(t)&&(t=this._resolve(e),this._cache.set(e,t)),t},e.prototype._resolve=function(e){for(var t=d.reflector.annotations(e),r=0;r0,e.render,t,r,f(o),e.textBindings.length,a);return h(s,o,n),s}function l(e){return x.ListWrapper.map(e,function(e){return u(e.renderProtoView)})}function u(e){var t=new Map;return x.MapWrapper.forEach(e.variableBindings,function(e,r){t.set(r,e)}),t}function p(e){var t=x.ListWrapper.createFixedSize(e.length);return x.ListWrapper.forEach(e,function(e){var r=S.isPresent(e.parentIndex)?t[e.parentIndex]:null;t[e.index]=d(r,e.renderProtoView)}),t}function d(e,t){var r=S.isBlank(e)?[]:x.ListWrapper.clone(e);return x.MapWrapper.forEach(t.variableBindings,function(e,t){r.push(e)}),x.ListWrapper.forEach(t.elementBinders,function(e){x.MapWrapper.forEach(e.variableBindings,function(e,t){r.push(e)})}),r}function f(e){for(var t=new Map,r=0;r0&&s[0].metadata.type===A.RenderDirectiveMetadata.COMPONENT_TYPE&&(c=s[0]);var l=m(n,a,i,c,s);v(e,n,i,l,c,s)}}function g(e,t,r){var n=0;do{var i=r[e];if(e=i.parentIndex,-1!==e){n+=i.distanceToParent;var o=t[e];if(S.isPresent(o.protoElementInjector))return new j(o.protoElementInjector,n)}}while(-1!==e);return new j(null,0)}function m(e,t,r,n,i){var o=null,a=x.MapWrapper.size(r.variableBindings)>0;if(i.length>0||a||S.isPresent(r.nestedProtoView)){var s=y(r,i);o=N.ProtoElementInjector.create(t.protoElementInjector,e,i,S.isPresent(n),t.distance,s),o.attributes=r.readAttributes}return o}function v(e,t,r,n,i,o){var a=null;-1!==r.parentIndex&&(a=e.elementBinders[r.parentIndex]);var s=e.bindElement(a,r.distanceToParent,n,i);return x.MapWrapper.forEach(r.variableBindings,function(t,r){e.protoLocals.set(t,null)}),s}function y(e,t){var r=new Map;return x.MapWrapper.forEach(e.variableBindings,function(n,i){var o=_(e,t,i);r.set(n,o)}),r}function _(e,t,r){for(var n,i=null,o=0;o0?h.ListWrapper.removeAt(i,i.length-1):o++;break;default:i.push(s)}}if(""==t){for(;o-->0;)h.ListWrapper.insert(i,0,"..");0===i.length&&i.push(".")}return t+i.join("/")+r}function a(e){var t=e[m.Path];return t=f.isBlank(t)?"":o(t),e[m.Path]=t,n(e[m.Scheme],e[m.UserInfo],e[m.Domain],e[m.Port],t,e[m.QueryData],e[m.Fragment])}function s(e,t){var r=i(encodeURI(t)),n=i(e);if(f.isPresent(r[m.Scheme]))return a(r);r[m.Scheme]=n[m.Scheme];for(var o=m.Scheme;o<=m.Port;o++)f.isBlank(r[o])&&(r[o]=n[o]); + +if("/"==r[m.Path][0])return a(r);var s=n[m.Path];f.isBlank(s)&&(s="/");var c=s.lastIndexOf("/");return s=s.substring(0,c+1)+r[m.Path],r[m.Path]=s,a(r)}var c=System.global,l=c.define;c.define=void 0;var u=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/di"),f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/collection"),g=function(){function e(){}return e.prototype.resolve=function(e,t){return s(e,t)},e=u([d.Injectable(),p("design:paramtypes",[])],e)}();t.UrlResolver=g;var m,v=f.RegExpWrapper.create("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");return function(e){e[e.Scheme=1]="Scheme",e[e.UserInfo=2]="UserInfo",e[e.Domain=3]="Domain",e[e.Port=4]="Port",e[e.Path=5]="Path",e[e.QueryData=6]="QueryData",e[e.Fragment=7]="Fragment"}(m||(m={})),c.define=l,r.exports}),System.register("angular2/src/core/services/app_root_url",["angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=function(){function e(e){this._value=e}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e},enumerable:!0,configurable:!0}),e=o([s.Injectable(),a("design:paramtypes",[String])],e)}();return t.AppRootUrl=c,n.define=i,r.exports}),System.register("angular2/src/core/compiler/dynamic_component_loader",["angular2/src/core/di","angular2/src/core/compiler/compiler","angular2/src/core/facade/lang","angular2/src/core/compiler/view_manager"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/compiler/compiler"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/compiler/view_manager"),p=function(){function e(e,t,r,n,i){this._dispose=i,this.location=e,this.instance=t,this.componentType=r,this.injector=n}return Object.defineProperty(e.prototype,"hostView",{get:function(){return this.location.parentView},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostComponentType",{get:function(){return this.componentType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostComponent",{get:function(){return this.instance},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this._dispose()},e}();t.ComponentRef=p;var d=function(){function e(e,t){this._compiler=e,this._viewManager=t}return e.prototype.loadAsRoot=function(e,t,r,n){var i=this;return this._compiler.compileInHost(e).then(function(o){var a=i._viewManager.createRootHostView(o,t,r),s=i._viewManager.getHostElement(a),c=i._viewManager.getComponent(s),u=function(){i._viewManager.destroyRootHostView(a),l.isPresent(n)&&n()};return new p(s,c,e,r,u)})},e.prototype.loadIntoLocation=function(e,t,r,n){return void 0===n&&(n=null),this.loadNextToLocation(e,this._viewManager.getNamedElementInComponentView(t,r),n)},e.prototype.loadNextToLocation=function(e,t,r){var n=this;return void 0===r&&(r=null),this._compiler.compileInHost(e).then(function(i){var o=n._viewManager.getViewContainer(t),a=o.createHostView(i,o.length,r),s=n._viewManager.getHostElement(a),c=n._viewManager.getComponent(s),l=function(){var e=o.indexOf(a);-1!==e&&o.remove(e)};return new p(s,c,e,null,l)})},e=o([s.Injectable(),a("design:paramtypes",[c.Compiler,u.AppViewManager])],e)}();return t.DynamicComponentLoader=d,n.define=i,r.exports}),System.register("angular2/src/core/render/xhr",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.get=function(e){return null},e}();return t.XHR=o,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/style_url_resolver",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/services/url_resolver"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/services/url_resolver"),u=function(){function e(e){this._resolver=e}return e.prototype.resolveUrls=function(e,t){return e=this._replaceUrls(e,p,t),e=this._replaceUrls(e,d,t)},e.prototype._replaceUrls=function(e,t,r){var n=this;return c.StringWrapper.replaceAllMapped(e,t,function(e){var t=e[1],i=e[2];if(c.RegExpWrapper.test(h,i))return e[0];var o=c.StringWrapper.replaceAll(i,f,""),a=e[3],s=n._resolver.resolve(r,o);return t+"'"+s+"'"+a})},e=o([s.Injectable(),a("design:paramtypes",[l.UrlResolver])],e)}();t.StyleUrlResolver=u;var p=/(url\()([^)]*)(\))/g,d=/(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g,f=/['"]/g,h=/^['"]?data:/g;return n.define=i,r.exports}),System.register("angular2/src/core/render/dom/dom_tokens",["angular2/src/core/di","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(){return""+i()+i()+i()}function i(){return c.StringWrapper.fromCharCode(97+c.Math.floor(25*c.Math.random()))}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang");return t.DOCUMENT=c.CONST_EXPR(new s.OpaqueToken("DocumentToken")),t.APP_ID=c.CONST_EXPR(new s.OpaqueToken("AppId")),t.APP_ID_RANDOM_BINDING=c.CONST_EXPR(new s.Binding(t.APP_ID,{toFactory:n,deps:[]})),t.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE=c.CONST_EXPR(new s.OpaqueToken("MaxInMemoryElementsPerTemplate")),o.define=a,r.exports}),System.register("angular2/src/core/render/dom/compiler/compile_element",["angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){var t=new l.StringJoiner,r=c.DOM.attributeMap(e);return t.add("<"),t.add(c.DOM.tagName(e).toLowerCase()),i(t,"id",r.get("id")),i(t,"class",r.get("class")),s.MapWrapper.forEach(r,function(e,r){"id"!==r&&"class"!==r&&i(t,r,e)}),t.add(">"),t.toString()}function i(e,t,r){l.isPresent(r)&&e.add(0===r.length?" "+t:" "+t+'="'+r+'"')}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/facade/lang"),u=function(){function e(e,t){void 0===t&&(t=""),this.element=e,this._attrs=null,this._classList=null,this.isViewRoot=!1,this.inheritedProtoView=null,this.distanceToInheritedBinder=0,this.inheritedElementBinder=null,this.compileChildren=!0;var r=l.assertionsEnabled()?n(e):null;""!==t?(this.elementDescription=t,l.isPresent(r)&&(this.elementDescription+=": "+r)):this.elementDescription=r}return e.prototype.isBound=function(){return l.isPresent(this.inheritedElementBinder)&&0===this.distanceToInheritedBinder},e.prototype.bindElement=function(){if(!this.isBound()){var e=this.inheritedElementBinder;this.inheritedElementBinder=this.inheritedProtoView.bindElement(this.element,this.elementDescription),l.isPresent(e)&&this.inheritedElementBinder.setParent(e,this.distanceToInheritedBinder),this.distanceToInheritedBinder=0}return this.inheritedElementBinder},e.prototype.attrs=function(){return l.isBlank(this._attrs)&&(this._attrs=c.DOM.attributeMap(this.element)),this._attrs},e.prototype.classList=function(){if(l.isBlank(this._classList)){this._classList=[];for(var e=c.DOM.classList(this.element),t=0;t0&&a.isBlank(t.element)&&o.ListWrapper.isEmpty(t.classNames)&&o.ListWrapper.isEmpty(t.attrs)&&(t.element="*"),e.push(t)},c=new e,u=a.RegExpWrapper.matcher(l,t),p=c,d=!1;a.isPresent(r=a.RegExpMatcherWrapper.next(u));){if(a.isPresent(r[1])){if(d)throw new s.BaseException("Nesting :not is not allowed in a selector");d=!0,p=new e,c.notSelectors.push(p)}if(a.isPresent(r[2])&&p.setElement(r[2]),a.isPresent(r[3])&&p.addClassName(r[3]),a.isPresent(r[4])&&p.addAttribute(r[4],r[5]),a.isPresent(r[6])&&(d=!1,p=c),a.isPresent(r[7])){if(d)throw new s.BaseException("Multiple selectors in :not are not supported");i(n,c),c=p=new e}}return i(n,c),n},e.prototype.isElementSelector=function(){return a.isPresent(this.element)&&o.ListWrapper.isEmpty(this.classNames)&&o.ListWrapper.isEmpty(this.attrs)&&0===this.notSelectors.length},e.prototype.setElement=function(e){void 0===e&&(e=null),a.isPresent(e)&&(e=e.toLowerCase()),this.element=e},e.prototype.getMatchingElementTemplate=function(){for(var e=a.isPresent(this.element)?this.element:"div",t=this.classNames.length>0?' class="'+this.classNames.join(" ")+'"':"",r="",n=0;n"},e.prototype.addAttribute=function(e,t){void 0===t&&(t=c),this.attrs.push(e.toLowerCase()),t=a.isPresent(t)?t.toLowerCase():c,this.attrs.push(t)},e.prototype.addClassName=function(e){this.classNames.push(e.toLowerCase())},e.prototype.toString=function(){var e="";if(a.isPresent(this.element)&&(e+=this.element),a.isPresent(this.classNames))for(var t=0;t0&&(e+="="+n),e+="]"}return o.ListWrapper.forEach(this.notSelectors,function(t){e+=":not("+t.toString()+")"}),e},e}();t.CssSelector=u;var p=function(){function e(){this._elementMap=new o.Map,this._elementPartialMap=new o.Map,this._classMap=new o.Map,this._classPartialMap=new o.Map,this._attrValueMap=new o.Map,this._attrValuePartialMap=new o.Map,this._listContexts=[]}return e.createNotMatcher=function(t){var r=new e;return r.addSelectables(t,null),r},e.prototype.addSelectables=function(e,t){var r=null;e.length>1&&(r=new d(e),this._listContexts.push(r));for(var n=0;n0&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)){var n=p.createNotMatcher(this.notSelectors);r=!n.match(e,null)}return r&&a.isPresent(t)&&(a.isBlank(this.listContext)||!this.listContext.alreadyMatched)&&(a.isPresent(this.listContext)&&(this.listContext.alreadyMatched=!0),t(this.selector,this.cbContext)),r},e}();return t.SelectorContext=f,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/view_splitter",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection","angular2/src/core/render/dom/compiler/compile_element","angular2/src/core/render/dom/util"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/dom/dom_adapter"),c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/render/dom/compiler/compile_element"),u=e("angular2/src/core/render/dom/util"),p=function(){function e(e){this._parser=e}return e.prototype.processStyle=function(e){return e},e.prototype.processElement=function(e,t,r){var n=t.attrs(),i=n.get("template"),u=o.isPresent(i);if(c.MapWrapper.forEach(n,function(e,r){if(o.StringWrapper.startsWith(r,"*")){var n=o.StringWrapper.substring(r,1);if(u)throw new a.BaseException("Only one template directive per element is allowed: "+(i+" and "+n+" cannot be used simultaneously ")+("in "+t.elementDescription));i=0==e.length?n:n+" "+e,u=!0}}),o.isPresent(e)){if(s.DOM.isTemplateElement(t.element)&&!t.isViewRoot){var p=new l.CompileElement(s.DOM.createTemplate(""));p.inheritedProtoView=t.bindElement().bindNestedProtoView(p.element),p.elementDescription=t.elementDescription,p.isViewRoot=!0,this._moveChildNodes(s.DOM.content(t.element),s.DOM.content(p.element)),r.addChild(p)}if(u){var d=new l.CompileElement(s.DOM.createTemplate(""));d.inheritedProtoView=t.inheritedProtoView,d.inheritedElementBinder=t.inheritedElementBinder,d.distanceToInheritedBinder=t.distanceToInheritedBinder,d.elementDescription=t.elementDescription;var p=new l.CompileElement(s.DOM.createTemplate(""));p.inheritedProtoView=d.bindElement().bindNestedProtoView(p.element),p.elementDescription=t.elementDescription,p.isViewRoot=!0,t.inheritedProtoView=p.inheritedProtoView,t.inheritedElementBinder=null,t.distanceToInheritedBinder=0,this._parseTemplateBindings(i,d),s.DOM.insertBefore(t.element,d.element),r.addParent(d),s.DOM.appendChild(s.DOM.content(p.element),t.element),r.addParent(p)}}},e.prototype._moveChildNodes=function(e,t){for(var r=s.DOM.firstChild(e);o.isPresent(r);)s.DOM.appendChild(t,r),r=s.DOM.firstChild(e)},e.prototype._parseTemplateBindings=function(e,t){for(var r=this._parser.parseTemplateBindings(e,t.elementDescription),n=0;n","+","~"],i=e,o="["+t+"]",a=0;a0&&!c.ListWrapper.contains(n,t)&&!l.StringWrapper.contains(t,o)){var r=/([^:]*)(:*)(.*)/g,i=l.RegExpWrapper.firstMatch(r,t);l.isPresent(i)&&(e=i[1]+o+i[2]+i[3])}return e}).join(s)}return i},e.prototype._insertPolyfillHostInCssText=function(e){return e=l.StringWrapper.replaceAll(e,E,g),e=l.StringWrapper.replaceAll(e,R,h)},e.prototype._propertiesFromRule=function(e){var t=e.style.cssText,r=/['"]+|attr/g;if(e.style.content.length>0&&!l.isPresent(l.RegExpWrapper.firstMatch(r,e.style.content))){var n=/content:[^;]*;/g;t=l.StringWrapper.replaceAll(t,n,"content: '"+e.style.content+"';")}return t},e}();t.ShadowCss=u;var p=/polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,d=/(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,f=/(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,h="-shadowcsshost",g="-shadowcsscontext",m=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",v=l.RegExpWrapper.create("("+h+m,"im"),y=l.RegExpWrapper.create("("+g+m,"im"),_=h+"-no-combinator",b=[/>>>/g,/::shadow/g,/::content/g,/\/deep\//g,/\/shadow-deep\//g,/\/shadow\//g],w="([>\\s~+[.,{:][\\s\\S]*)?$",C=l.RegExpWrapper.create(h,"im"),R=/:host/gim,E=/:host-context/gim;return o.define=a,r.exports}),System.register("angular2/src/core/render/dom/schema/element_schema_registry",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){}return e.prototype.hasProperty=function(e,t){return!0},e.prototype.getMappedPropName=function(e){return e},e}();return t.ElementSchemaRegistry=o,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/view/proto_view_merger",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/render/dom/view/proto_view","angular2/src/core/render/dom/view/element_binder","angular2/src/core/render/api","angular2/src/core/render/dom/util"],!0,function(e,t,r){function n(e,t){var r=[],n=[];i(e,t,r,n);var c=r[0];s(r,n);var u=[],p=new Set;l(r,n,u,p),o(r);var d=u.map(function(e){return e.length}),f=y(u),h=O.DOM.content(f),g=k.queryBoundElements(h,!1),m=new Map,v=a(r),w=_(h,v,m),C=b(r,g,p,v,m),S=R(r,g),D=E(r,m),I=P(r,n),M=x(n),A=T.DomProtoView.create(e,c.original.type,f,c.original.encapsulation,d,w,C,new Map);return new B.RenderProtoViewMergeMapping(new T.DomProtoViewRef(A),d.length,S,g.length,D,I,M)}function i(e,t,r,n){var o=T.resolveInternalDomProtoView(t[0]),a=r.length;r.push(k.cloneAndQueryProtoView(e,o,!1)),0===n.length&&n.push([null,null]);for(var s=1,c=0;c=1&&O.DOM.appendChild(r,O.DOM.createComment("|")),i.forEach(function(e){O.DOM.appendChild(r,e)})}return t}function _(e,t,r){var n=[];return k.queryBoundTextNodeIndices(e,t,function(e,t,i){n.push(t),r.set(e,r.size)}),n}function b(e,t,r,n,i){for(var o=w(e),a=[],s=0;s=1;r--){var n=e[r];M.isPresent(n)&&(t[n[0]]+=t[r]+1)}return t}function S(e){for(var t=new Map,r=0;r=0&&t>=this.maxInMemoryElementsPerTemplate?u.DOM.getInnerHTML(e):e},e.prototype.cloneContent=function(e,t){var r;return c.isString(e)?(r=u.DOM.content(u.DOM.createTemplate(e)),t&&(r=u.DOM.importIntoDoc(r))):(r=u.DOM.content(e),r=t?u.DOM.importIntoDoc(r):u.DOM.clone(r)),r},e=o([l.Injectable(),s(0,l.Inject(p.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)),a("design:paramtypes",[Object])],e)}();return t.TemplateCloner=d,n.define=i,r.exports}),System.register("angular2/src/animate/css_animation_options",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(){this.classesToAdd=[],this.classesToRemove=[],this.animationClasses=[]}return e}();return t.CssAnimationOptions=o,n.define=i,r.exports}),System.register("angular2/src/core/facade/math",["angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang");return t.Math=o.global.Math,t.NaN=typeof t.NaN,n.define=i,r.exports}),System.register("angular2/src/animate/browser_details",["angular2/src/core/di","angular2/src/core/facade/math","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/math"),l=e("angular2/src/core/dom/dom_adapter"),u=function(){function e(){this.elapsedTimeIncludesDelay=!1,this.doesElapsedTimeIncludesDelay()}return e.prototype.doesElapsedTimeIncludesDelay=function(){var e=this,t=l.DOM.createElement("div");l.DOM.setAttribute(t,"style","position: absolute; top: -9999px; left: -9999px; width: 1px;\n height: 1px; transition: all 1ms linear 1ms;"),this.raf(function(r){l.DOM.on(t,"transitionend",function(r){var n=c.Math.round(1e3*r.elapsedTime);e.elapsedTimeIncludesDelay=2==n,l.DOM.remove(t)}),l.DOM.setStyle(t,"width","2px")},2)},e.prototype.raf=function(e,t){void 0===t&&(t=1);var r=new p(e,t);return function(){return r.cancel()}},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();t.BrowserDetails=u;var p=function(){function e(e,t){this.callback=e,this.frames=t,this._raf()}return e.prototype._raf=function(){var e=this;this.currentFrameId=l.DOM.requestAnimationFrame(function(t){return e._nextFrame(t)})},e.prototype._nextFrame=function(e){this.frames--,this.frames>0?this._raf():this.callback(e)},e.prototype.cancel=function(){l.DOM.cancelAnimationFrame(this.currentFrameId),this.currentFrameId=null},e}();return n.define=i,r.exports}),System.register("angular2/src/core/zone/ng_zone",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/profile/profile"),c=function(){function e(e){var t=e.enableLongStackTrace;this._runScope=s.wtfCreateScope("NgZone#run()"),this._microtaskScope=s.wtfCreateScope("NgZone#microtask()"),this._inVmTurnDone=!1,this._pendingTimeouts=[],this._onTurnStart=null,this._onTurnDone=null,this._onEventDone=null,this._onErrorHandler=null,this._pendingMicrotasks=0,this._hasExecutedCodeInInnerZone=!1,this._nestedRun=0,a.global.zone?(this._disabled=!1,this._mountZone=a.global.zone,this._innerZone=this._createInnerZone(this._mountZone,t)):(this._disabled=!0,this._mountZone=null)}return e.prototype.overrideOnTurnStart=function(e){this._onTurnStart=a.normalizeBlank(e)},e.prototype.overrideOnTurnDone=function(e){this._onTurnDone=a.normalizeBlank(e)},e.prototype.overrideOnEventDone=function(e,t){var r=this;void 0===t&&(t=!1);var n=a.normalizeBlank(e);this._onEventDone=t?function(){r._pendingTimeouts.length||n()}:n},e.prototype.overrideOnErrorHandler=function(e){this._onErrorHandler=a.normalizeBlank(e)},e.prototype.run=function(e){if(this._disabled)return e();var t=this._runScope();try{return this._innerZone.run(e)}finally{s.wtfLeave(t)}},e.prototype.runOutsideAngular=function(e){return this._disabled?e():this._mountZone.run(e)},e.prototype._createInnerZone=function(e,t){var r,n=this._microtaskScope,i=this;return r=t?o.StringMapWrapper.merge(Zone.longStackTraceZone,{onError:function(e){i._onError(this,e)}}):{onError:function(e){i._onError(this,e)}},e.fork(r).fork({$run:function(e){return function(){try{return i._nestedRun++,i._hasExecutedCodeInInnerZone||(i._hasExecutedCodeInInnerZone=!0,i._onTurnStart&&e.call(i._innerZone,i._onTurnStart)),e.apply(this,arguments)}finally{if(i._nestedRun--,0==i._pendingMicrotasks&&0==i._nestedRun&&!this._inVmTurnDone){if(i._onTurnDone&&i._hasExecutedCodeInInnerZone)try{this._inVmTurnDone=!0,e.call(i._innerZone,i._onTurnDone)}finally{this._inVmTurnDone=!1,i._hasExecutedCodeInInnerZone=!1}0===i._pendingMicrotasks&&a.isPresent(i._onEventDone)&&i.runOutsideAngular(i._onEventDone)}}}},$scheduleMicrotask:function(e){return function(t){i._pendingMicrotasks++;var r=function(){var e=n();try{t()}finally{i._pendingMicrotasks--,s.wtfLeave(e)}};e.call(this,r)}},$setTimeout:function(e){return function(t,r){for(var n=[],a=2;a1?e[1]:null;return this.control(t,r)}return this.control(e)},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.FormBuilder=p,n.define=i,r.exports}),System.register("angular2/src/core/dom/generic_browser_adapter",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/collection"),s=e("angular2/src/core/facade/lang"),c=e("angular2/src/core/dom/dom_adapter"),l=function(e){function t(){var t=this;e.call(this),this._animationPrefix=null,this._transitionEnd=null;try{var r=this.createElement("div",this.defaultDoc());if(s.isPresent(this.getStyle(r,"animationName")))this._animationPrefix="";else for(var n=["Webkit","Moz","O","ms"],i=0;i=200&&300>=i?t.resolve(n):t.reject("Failed to load "+e,null)},r.onerror=function(){t.reject("Failed to load "+e,null)},r.send(),t.promise},t=a([c.Injectable(),s("design:paramtypes",[])],t)}(p.XHR);return t.XHRImpl=d,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/key_events",["angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/render/dom/events/event_manager","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e; + +},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/render/dom/events/event_manager"),d=e("angular2/src/core/di"),f=["alt","control","meta","shift"],h={alt:function(e){return e.altKey},control:function(e){return e.ctrlKey},meta:function(e){return e.metaKey},shift:function(e){return e.shiftKey}},g=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return l.isPresent(t.parseEventName(e))},t.prototype.addEventListener=function(e,r,n){var i=t.parseEventName(r),o=t.eventCallback(e,u.StringMapWrapper.get(i,"fullKey"),n,this.manager.getZone());this.manager.getZone().runOutsideAngular(function(){c.DOM.on(e,u.StringMapWrapper.get(i,"domEventName"),o)})},t.parseEventName=function(e){var r=e.toLowerCase().split("."),n=u.ListWrapper.removeAt(r,0);if(0===r.length||!l.StringWrapper.equals(n,"keydown")&&!l.StringWrapper.equals(n,"keyup"))return null;var i=t._normalizeKey(u.ListWrapper.removeLast(r)),o="";if(u.ListWrapper.forEach(f,function(e){u.ListWrapper.contains(r,e)&&(u.ListWrapper.remove(r,e),o+=e+".")}),o+=i,0!=r.length||0===i.length)return null;var a=u.StringMapWrapper.create();return u.StringMapWrapper.set(a,"domEventName",n),u.StringMapWrapper.set(a,"fullKey",o),a},t.getEventFullKey=function(e){var t="",r=c.DOM.getEventKey(e);return r=r.toLowerCase(),l.StringWrapper.equals(r," ")?r="space":l.StringWrapper.equals(r,".")&&(r="dot"),u.ListWrapper.forEach(f,function(n){if(n!=r){var i=u.StringMapWrapper.get(h,n);i(e)&&(t+=n+".")}}),t+=r},t.eventCallback=function(e,r,n,i){return function(e){l.StringWrapper.equals(t.getEventFullKey(e),r)&&i.run(function(){return n(e)})}},t._normalizeKey=function(e){switch(e){case"esc":return"escape";default:return e}},t=a([d.Injectable(),s("design:paramtypes",[])],t)}(p.EventManagerPlugin);return t.KeyEventsPlugin=g,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/hammer_common",["angular2/src/core/render/dom/events/event_manager","angular2/src/core/facade/collection"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/render/dom/events/event_manager"),s=e("angular2/src/core/facade/collection"),c={pan:!0,panstart:!0,panmove:!0,panend:!0,pancancel:!0,panleft:!0,panright:!0,panup:!0,pandown:!0,pinch:!0,pinchstart:!0,pinchmove:!0,pinchend:!0,pinchcancel:!0,pinchin:!0,pinchout:!0,press:!0,pressup:!0,rotate:!0,rotatestart:!0,rotatemove:!0,rotateend:!0,rotatecancel:!0,swipe:!0,swipeleft:!0,swiperight:!0,swipeup:!0,swipedown:!0,tap:!0},l=function(e){function t(){e.call(this)}return o(t,e),t.prototype.supports=function(e){return e=e.toLowerCase(),s.StringMapWrapper.contains(c,e)},t}(a.EventManagerPlugin);return t.HammerGesturesPluginCommon=l,n.define=i,r.exports}),System.register("angular2/src/core/services/anchor_based_app_root_url",["angular2/src/core/services/app_root_url","angular2/src/core/dom/dom_adapter","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/services/app_root_url"),l=e("angular2/src/core/dom/dom_adapter"),u=e("angular2/src/core/di"),p=function(e){function t(){e.call(this,"");var t,r=l.DOM.createElement("a");l.DOM.resolveAndSetHref(r,"./",null),t=l.DOM.getHref(r),this.value=t}return o(t,e),t=a([u.Injectable(),s("design:paramtypes",[])],t)}(c.AppRootUrl);return t.AnchorBasedAppRootUrl=p,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/render/dom/schema/element_schema_registry"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection"),c=e("angular2/src/core/dom/dom_adapter"),l=e("angular2/src/core/render/dom/schema/element_schema_registry"),u=function(e){function t(){e.apply(this,arguments),this._protoElements=new Map}return o(t,e),t.prototype._getProtoElement=function(e){var t=this._protoElements.get(e);return a.isBlank(t)&&(t=c.DOM.createElement(e),this._protoElements.set(e,t)),t},t.prototype.hasProperty=function(e,t){if(-1!==e.indexOf("-"))return!0;var r=this._getProtoElement(e);return c.DOM.hasProperty(r,t)},t.prototype.getMappedPropName=function(e){var t=s.StringMapWrapper.get(c.DOM.attrToPropMap,e);return a.isPresent(t)?t:e},t}(l.ElementSchemaRegistry);return t.DomElementSchemaRegistry=u,n.define=i,r.exports}),System.register("angular2/src/core/platform_bindings",["angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/dom/dom_adapter");return t.EXCEPTION_BINDING=o.bind(a.ExceptionHandler).toFactory(function(){return new a.ExceptionHandler(s.DOM,!1)},[]),n.define=i,r.exports}),System.register("angular2/src/core/profile/wtf_init",[],!0,function(e,t,r){function n(){}var i=System.global,o=i.define;return i.define=void 0,t.wtfInit=n,i.define=o,r.exports}),System.register("angular2/src/core/life_cycle/life_cycle",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/profile/profile"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/di"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/profile/profile"),p=function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=!1),this._runningTick=!1,this._changeDetectors=[],c.isPresent(e)&&this._changeDetectors.push(e),this._enforceNoNewChanges=t}return e.prototype.registerWith=function(e,t){var r=this;void 0===t&&(t=null),c.isPresent(t)&&this._changeDetectors.push(t),e.overrideOnTurnDone(function(){return r.tick()})},e.prototype.tick=function(){if(this._runningTick)throw new l.BaseException("LifeCycle.tick is called recursively");var t=e._tickScope();try{this._runningTick=!0,this._changeDetectors.forEach(function(e){return e.detectChanges()}),this._enforceNoNewChanges&&this._changeDetectors.forEach(function(e){return e.checkNoChanges()})}finally{this._runningTick=!1,u.wtfLeave(t)}},e._tickScope=u.wtfCreateScope("LifeCycle#tick()"),e=o([s.Injectable(),a("design:paramtypes",[Object,Boolean])],e)}();return t.LifeCycle=p,n.define=i,r.exports}),System.register("angular2/src/core/compiler/template_commands",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){return new y(e,t,r)}function i(e){return new _(e)}function o(e,t,r,n,i,o,a){return new b(e,t,r,n,i,o,a)}function a(){return new w}function s(e,t,r,n,i,o,a,s){return new C(e,t,r,n,i,o,a,s)}function c(){return new R}function l(e,t,r,n,i,o,a){return new E(e,t,r,n,i,o,a)}function u(e,t,r){void 0===r&&(r=null);for(var n=0;n "+r+" ).toList()":".map(function("+e.join(",")+") { return "+r+"; })"}function p(e,r){return t.IS_DART?".replaceAll('"+e+"', '"+r+"')":".replace(/"+e+"/g, '"+r+"')"}function d(e,r){return t.IS_DART?"("+e.join(",")+") => "+r:"function("+e.join(",")+") { return "+r+"; }"}function f(e,t){var r=m.StringWrapper.split(e.trim(),/\s*:\s*/g);return r.length>1?r:t}var h=System.global,g=h.define;h.define=void 0;var m=e("angular2/src/core/facade/lang"),v=/([A-Z])/g,y=/-([a-z])/g,_=/'|\\|\n|\$/g,b=/"|\\|\n|\$/g;return t.IS_DART=!m.isJsObject({}),t.camelCaseToDashCase=n,t.dashCaseToCamelCase=i,t.escapeSingleQuoteString=o,t.escapeDoubleQuoteString=a,t.codeGenExportVariable=c,t.codeGenConcatArray=l,t.codeGenMapArray=u,t.codeGenReplaceAll=p,t.codeGenValueFn=d,t.splitAtColon=f,h.define=g,r.exports}),System.register("angular2/src/compiler/source_module",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){return"#MODULE["+e+"]"}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=/#MODULE\[([^\]]*)\]/g;t.moduleRef=n;var c=function(){function e(e,t){this.moduleId=e,this.sourceWithModuleRefs=t}return e.prototype.getSourceWithImports=function(){var e=this,t={},r=[],n=a.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs,s,function(n){var i=n[1],o=t[i];return a.isBlank(o)&&(i==e.moduleId?o="":(o="import"+r.length,r.push([i,o])),t[i]=o),o.length>0?o+".":""});return new p(n,r)},e}();t.SourceModule=c;var l=function(){function e(e,t){this.declarations=e,this.expression=t}return e}();t.SourceExpression=l;var u=function(){function e(e,t){this.declarations=e,this.expressions=t}return e}();t.SourceExpressions=u;var p=function(){function e(e,t){this.source=e,this.imports=t}return e}();return t.SourceWithImports=p,i.define=o,r.exports}),System.register("angular2/src/compiler/template_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.TextAst=s;var c=function(){function e(e,t,r){this.value=e,this.ngContentIndex=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitBoundText(this,t)},e}();t.BoundTextAst=c;var l=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.AttrAst=l;var u=function(){function e(e,t,r,n,i){this.name=e,this.type=t,this.value=r,this.unit=n,this.sourceInfo=i}return e.prototype.visit=function(e,t){return e.visitElementProperty(this,t)},e}();t.BoundElementPropertyAst=u;var p=function(){function e(e,t,r,n){this.name=e,this.target=t,this.handler=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitEvent(this,t)},Object.defineProperty(e.prototype,"fullName",{get:function(){return a.isPresent(this.target)?this.target+":"+this.name:this.name},enumerable:!0,configurable:!0}),e}();t.BoundEventAst=p;var d=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitVariable(this,t)},e}();t.VariableAst=d;var f=function(){function e(e,t,r,n,i,o,a,s,c){this.name=e,this.attrs=t,this.properties=r,this.events=n,this.exportAsVars=i,this.directives=o,this.children=a,this.ngContentIndex=s,this.sourceInfo=c}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e.prototype.isBound=function(){return this.properties.length>0||this.events.length>0||this.exportAsVars.length>0||this.directives.length>0},e.prototype.getComponent=function(){return this.directives.length>0&&this.directives[0].directive.isComponent?this.directives[0].directive:null},e}();t.ElementAst=f;var h=function(){function e(e,t,r,n,i,o){this.attrs=e,this.vars=t,this.directives=r,this.children=n,this.ngContentIndex=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitEmbeddedTemplate(this,t)},e}();t.EmbeddedTemplateAst=h;var g=function(){function e(e,t,r,n){this.directiveName=e,this.templateName=t,this.value=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitDirectiveProperty(this,t)},e}();t.BoundDirectivePropertyAst=g;var m=function(){function e(e,t,r,n,i,o){this.directive=e,this.properties=t,this.hostProperties=r,this.hostEvents=n,this.exportAsVars=i,this.sourceInfo=o}return e.prototype.visit=function(e,t){return e.visitDirective(this,t)},e}();t.DirectiveAst=m;var v=function(){function e(e,t){this.ngContentIndex=e,this.sourceInfo=t}return e.prototype.visit=function(e,t){return e.visitNgContent(this,t)},e}();return t.NgContentAst=v,function(e){e[e.Property=0]="Property",e[e.Attribute=1]="Attribute",e[e.Class=2]="Class",e[e.Style=3]="Style"}(t.PropertyBindingType||(t.PropertyBindingType={})),t.PropertyBindingType,t.templateVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/transform/template_compiler/change_detector_codegen",[],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=function(){function e(e){}return e.prototype.generate=function(e,t,r){throw"Not implemented in JS"},e.prototype.toString=function(){throw"Not implemented in JS"},e}();return t.Codegen=o,n.define=i,r.exports}),System.register("angular2/src/compiler/style_url_resolver",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){var n=[];return r=i(e,t,r,n),r=o(e,t,r),new l(r,n)}function i(e,t,r,n){return c.StringWrapper.replaceAllMapped(r,p,function(r){var i=c.isPresent(r[1])?r[1]:r[2];return n.push(e.resolve(t,i)),""})}function o(e,t,r){return c.StringWrapper.replaceAllMapped(r,u,function(r){var n=r[1],i=r[2];if(c.RegExpWrapper.test(f,i))return r[0];var o=c.StringWrapper.replaceAll(i,d,""),a=r[3],s=e.resolve(t,o);return n+"'"+s+"'"+a})}var a=System.global,s=a.define;a.define=void 0;var c=e("angular2/src/core/facade/lang");t.resolveStyleUrls=n;var l=function(){function e(e,t){this.style=e,this.styleUrls=t}return e}();t.StyleWithImports=l;var u=/(url\()([^)]*)(\))/g,p=/@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g,d=/['"]/g,f=/^['"]?data:/g;return a.define=s,r.exports}),System.register("angular2/src/compiler/command_compiler",["angular2/src/core/facade/lang","angular2/src/core/facade/collection","angular2/src/core/compiler/template_commands","angular2/src/compiler/template_ast","angular2/src/compiler/source_module","angular2/src/core/render/api","angular2/src/compiler/style_compiler","angular2/src/compiler/util","angular2/src/core/di"],!0,function(e,t,r){function n(e){return"["+e.map(function(e){return p.isString(e)?y.escapeSingleQuoteString(e):p.isBlank(e)?"null":e}).join(",")+"]"}function i(e){return e.map(function(e){return""+g.moduleRef(e.type.moduleId)+e.type.name})}function o(e,t,r){return h.templateVisitAll(e,t,r),r}function a(e){for(var t=new Set,r=[],n=0;n0,a=[];t.vars.forEach(function(e){a.push(e.name),a.push(e.value.length>0?e.value:b)});var s=[];return d.ListWrapper.forEachWithIndex(t.directives,function(e,t){e.visit(n,new P(t,[],[],s))}),this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex,this._readAttrNameAndValues(null,s,t.attrs),a,s,o,t.ngContentIndex,i.result)),this.transitiveNgContentCount+=i.transitiveNgContentCount,this.embeddedTemplateIndex=i.embeddedTemplateIndex,null},e.prototype.visitElement=function(e,t){var r=this,n=e.getComponent(),i=o(this,e.events,[]),s=[];p.isBlank(n)&&e.exportAsVars.forEach(function(e){s.push(e.name),s.push(null)});var c=[];d.ListWrapper.forEachWithIndex(e.directives,function(e,t){e.visit(r,new P(t,i,s,c))}),i=a(i);var l=this._readAttrNameAndValues(n,c,e.attrs);return p.isPresent(n)?(this.result.push(this.commandFactory.createBeginComponent(e.name,l,i,s,c,n.template.encapsulation===m.ViewEncapsulation.Native,e.ngContentIndex)),h.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndComponent())):(this.result.push(this.commandFactory.createBeginElement(e.name,l,i,s,c,e.isBound(),e.ngContentIndex)),h.templateVisitAll(this,e.children),this.result.push(this.commandFactory.createEndElement())),null},e.prototype.visitVariable=function(e,t){return null},e.prototype.visitAttr=function(e,t){return t.push(e.name),t.push(e.value),null},e.prototype.visitBoundText=function(e,t){return this.result.push(this.commandFactory.createText(null,!0,e.ngContentIndex)),null},e.prototype.visitText=function(e,t){return this.result.push(this.commandFactory.createText(e.value,!1,e.ngContentIndex)),null},e.prototype.visitDirective=function(e,t){return t.targetDirectives.push(e.directive),h.templateVisitAll(this,e.hostEvents,t.eventTargetAndNames),e.exportAsVars.forEach(function(e){t.targetVariableNameAndValues.push(e.name),t.targetVariableNameAndValues.push(t.index)}),null},e.prototype.visitEvent=function(e,t){return t.push(e.target),t.push(e.name),null},e.prototype.visitDirectiveProperty=function(e,t){return null},e.prototype.visitElementProperty=function(e,t){return null},e}(),P=function(){function e(e,t,r,n){this.index=e,this.eventTargetAndNames=t,this.targetVariableNameAndValues=r,this.targetDirectives=n}return e}();return s.define=c,r.exports}),System.register("angular2/src/compiler/html_ast",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e,t,r){void 0===r&&(r=null);var n=[];return t.forEach(function(t){var i=t.visit(e,r);a.isPresent(i)&&n.push(i)}),n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=function(){function e(e,t){this.value=e,this.sourceInfo=t}return e.prototype.visit=function(e,t){return e.visitText(this,t)},e}();t.HtmlTextAst=s;var c=function(){function e(e,t,r){this.name=e,this.value=t,this.sourceInfo=r}return e.prototype.visit=function(e,t){return e.visitAttr(this,t)},e}();t.HtmlAttrAst=c;var l=function(){function e(e,t,r,n){this.name=e,this.attrs=t,this.children=r,this.sourceInfo=n}return e.prototype.visit=function(e,t){return e.visitElement(this,t)},e}();return t.HtmlElementAst=l,t.htmlVisitAll=n,i.define=o,r.exports}),System.register("angular2/src/compiler/template_preparser",["angular2/src/core/facade/lang"],!0,function(e,t,r){function n(e){var t=null,r=null,n=null,o=!1;e.attrs.forEach(function(e){e.name==c?t=e.value:e.name==d?r=e.value:e.name==p?n=e.value:e.name==m&&(o=!0)}),t=i(t);var a=e.name,s=v.OTHER;return a==l?s=v.NG_CONTENT:a==h?s=v.STYLE:a==g?s=v.SCRIPT:a==u&&n==f&&(s=v.STYLESHEET),new y(s,t,r,o)}function i(e){return s.isBlank(e)||0===e.length?"*":e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/facade/lang"),c="select",l="ng-content",u="link",p="rel",d="href",f="stylesheet",h="style",g="script",m="ng-non-bindable";t.preparseElement=n,function(e){e[e.NG_CONTENT=0]="NG_CONTENT",e[e.STYLE=1]="STYLE",e[e.STYLESHEET=2]="STYLESHEET",e[e.SCRIPT=3]="SCRIPT",e[e.OTHER=4]="OTHER"}(t.PreparsedElementType||(t.PreparsedElementType={}));var v=t.PreparsedElementType,y=function(){function e(e,t,r,n){this.type=e,this.selectAttr=t,this.hrefAttr=r,this.nonBindable=n}return e}();return t.PreparsedElement=y,o.define=a,r.exports}),System.register("angular2/src/compiler/template_normalizer",["angular2/src/compiler/directive_metadata","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/async","angular2/src/core/render/xhr","angular2/src/core/services/url_resolver","angular2/src/compiler/style_url_resolver","angular2/src/core/di","angular2/src/core/render/api","angular2/src/compiler/html_ast","angular2/src/compiler/html_parser","angular2/src/compiler/template_preparser"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/compiler/directive_metadata"),c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/exceptions"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/render/xhr"),d=e("angular2/src/core/services/url_resolver"),f=e("angular2/src/compiler/style_url_resolver"),h=e("angular2/src/core/di"),g=e("angular2/src/core/render/api"),m=e("angular2/src/compiler/html_ast"),v=e("angular2/src/compiler/html_parser"),y=e("angular2/src/compiler/template_preparser"),_=function(){function e(e,t,r){this._xhr=e,this._urlResolver=t,this._domParser=r}return e.prototype.normalizeTemplate=function(e,t){var r=this;if(c.isPresent(t.template))return u.PromiseWrapper.resolve(this.normalizeLoadedTemplate(e,t,t.template,e.moduleId));if(c.isPresent(t.templateUrl)){var n=this._urlResolver.resolve(e.moduleId,t.templateUrl);return this._xhr.get(n).then(function(i){return r.normalizeLoadedTemplate(e,t,i,n)})}throw new l.BaseException("No template specified for component "+e.name)},e.prototype.normalizeLoadedTemplate=function(e,t,r,n){var i=this,o=this._domParser.parse(r,e.name),a=new b;m.htmlVisitAll(a,o);var c=t.styles.concat(a.styles),l=a.styleUrls.map(function(e){return i._urlResolver.resolve(n,e)}).concat(t.styleUrls.map(function(t){return i._urlResolver.resolve(e.moduleId,t)})),u=c.map(function(e){var t=f.resolveStyleUrls(i._urlResolver,n,e);return t.styleUrls.forEach(function(e){return l.push(e)}),t.style}),p=t.encapsulation;return p===g.ViewEncapsulation.Emulated&&0===u.length&&0===l.length&&(p=g.ViewEncapsulation.None),new s.CompileTemplateMetadata({encapsulation:p,template:r,templateUrl:n,styles:u,styleUrls:l,ngContentSelectors:a.ngContentSelectors})},e=o([h.Injectable(),a("design:paramtypes",[p.XHR,d.UrlResolver,v.HtmlParser])],e)}();t.TemplateNormalizer=_;var b=function(){function e(){this.ngContentSelectors=[],this.styles=[],this.styleUrls=[],this.ngNonBindableStackCount=0}return e.prototype.visitElement=function(e,t){var r=y.preparseElement(e);switch(r.type){case y.PreparsedElementType.NG_CONTENT:0===this.ngNonBindableStackCount&&this.ngContentSelectors.push(r.selectAttr);break;case y.PreparsedElementType.STYLE:var n="";e.children.forEach(function(e){e instanceof m.HtmlTextAst&&(n+=e.value)}),this.styles.push(n);break;case y.PreparsedElementType.STYLESHEET:this.styleUrls.push(r.hrefAttr)}return r.nonBindable&&this.ngNonBindableStackCount++,m.htmlVisitAll(this,e.children),r.nonBindable&&this.ngNonBindableStackCount--,null},e.prototype.visitAttr=function(e,t){return null},e.prototype.visitText=function(e,t){return null},e}();return n.define=i,r.exports}),System.register("angular2/src/compiler/runtime_metadata",["angular2/src/core/di","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/compiler/directive_metadata","angular2/src/core/metadata/directives","angular2/src/core/compiler/directive_resolver","angular2/src/core/compiler/view_resolver","angular2/src/core/compiler/directive_lifecycle_reflector","angular2/src/core/compiler/interfaces","angular2/src/core/reflection/reflection","angular2/src/core/di"],!0,function(e,t,r){ +function n(e){var t=new Map;return e.forEach(function(e){t.set(e.type.id,e)}),g.MapWrapper.values(t)}function i(e){if(f.isBlank(e.directives))return[];var t=[];return o(e.directives,t),t}function o(e,t){for(var r=0;r0&&this._renderer.setElementClass(this._ngEl,e,t)},e=o([c.Directive({selector:"[ng-class]",properties:["rawClass: ng-class","initialClasses: class"]}),a("design:paramtypes",[u.IterableDiffers,u.KeyValueDiffers,l.ElementRef,p.Renderer])],e)}();return t.NgClass=f,n.define=i,r.exports}),System.register("angular2/src/core/directives/ng_for",["angular2/src/core/metadata","angular2/src/core/change_detection","angular2/src/core/compiler","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/core/metadata"),c=e("angular2/src/core/change_detection"),l=e("angular2/src/core/compiler"),u=e("angular2/src/core/facade/lang"),p=function(){function e(e,t,r,n){this._viewContainer=e,this._templateRef=t,this._iterableDiffers=r,this._cdr=n}return Object.defineProperty(e.prototype,"ngForOf",{set:function(e){this._ngForOf=e,u.isBlank(this._differ)&&u.isPresent(e)&&(this._differ=this._iterableDiffers.find(e).create(this._cdr))},enumerable:!0,configurable:!0}),e.prototype.doCheck=function(){if(u.isPresent(this._differ)){var e=this._differ.diff(this._ngForOf);u.isPresent(e)&&this._applyChanges(e)}},e.prototype._applyChanges=function(e){var t=[];e.forEachRemovedItem(function(e){return t.push(new d(e,null))}),e.forEachMovedItem(function(e){return t.push(new d(e,null))});var r=this._bulkRemove(t);e.forEachAddedItem(function(e){return r.push(new d(e,null))}),this._bulkInsert(r);for(var n=0;nn;n++)this._viewContainer.get(n).setLocal("last",n===i-1)},e.prototype._perViewChange=function(e,t){e.setLocal("$implicit",t.item),e.setLocal("index",t.currentIndex),e.setLocal("even",t.currentIndex%2==0),e.setLocal("odd",t.currentIndex%2==1)},e.prototype._bulkRemove=function(e){e.sort(function(e,t){return e.record.previousIndex-t.record.previousIndex});for(var t=[],r=e.length-1;r>=0;r--){var n=e[r];u.isPresent(n.record.currentIndex)?(n.view=this._viewContainer.detach(n.record.previousIndex),t.push(n)):this._viewContainer.remove(n.record.previousIndex)}return t},e.prototype._bulkInsert=function(e){e.sort(function(e,t){return e.record.currentIndex-t.record.currentIndex});for(var t=0;t0?r[0]:null},e.prototype.queryAll=function(e,t){void 0===t&&(t=d.all);var r=t(this);return c.ListWrapper.filter(r,e)},e.prototype._getChildElements=function(t,r){var n=this,i=[],o=null;s.isPresent(r)&&(o=t.proto.elementBinders[r-t.elementOffset]);for(var a=0;a0){var r=a.StringWrapper.split(e,new RegExp("&"));s.ListWrapper.forEach(r,function(e){var r=a.StringWrapper.split(e,new RegExp("=")),n=r[0],i=r[1],o=a.isPresent(t.get(n))?t.get(n):[];o.push(i),t.set(n,o)})}return t}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/collection");t.URLSearchParamsUnionFixer=a.CONST_EXPR("UnionFixer");var c=function(){function e(e){void 0===e&&(e=""),this.rawParams=e,this.paramsMap=n(e)}return e.prototype.clone=function(){var t=new e;return t.appendAll(this),t},e.prototype.has=function(e){return this.paramsMap.has(e)},e.prototype.get=function(e){var t=this.paramsMap.get(e);return s.isListLikeIterable(t)?s.ListWrapper.first(t):null},e.prototype.getAll=function(e){var t=this.paramsMap.get(e);return a.isPresent(t)?t:[]},e.prototype.set=function(e,t){var r=this.paramsMap.get(e),n=a.isPresent(r)?r:[];s.ListWrapper.clear(n),n.push(t),this.paramsMap.set(e,n)},e.prototype.setAll=function(e){var t=this;s.MapWrapper.forEach(e.paramsMap,function(e,r){var n=t.paramsMap.get(r),i=a.isPresent(n)?n:[];s.ListWrapper.clear(i),i.push(e[0]),t.paramsMap.set(r,i)})},e.prototype.append=function(e,t){var r=this.paramsMap.get(e),n=a.isPresent(r)?r:[];n.push(t),this.paramsMap.set(e,n)},e.prototype.appendAll=function(e){var t=this;s.MapWrapper.forEach(e.paramsMap,function(e,r){for(var n=t.paramsMap.get(r),i=a.isPresent(n)?n:[],o=0;o0)throw new d.BaseException(e+" pending connections to be resolved")},e.prototype.resolveAllConnections=function(){u.ObservableWrapper.subscribe(this.connections,function(e){return e.readyState=4})},e.prototype.createConnection=function(e){if(!(p.isPresent(e)&&e instanceof c.Request))throw new d.BaseException("createConnection requires an instance of Request, got "+e);var t=new f(e);return u.ObservableWrapper.callNext(this.connections,t),t},e=o([s.Injectable(),a("design:paramtypes",[])],e)}();return t.MockBackend=h,n.define=i,r.exports}),System.register("angular2/src/core/di/decorators",["angular2/src/core/di/metadata","angular2/src/core/util/decorators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/di/metadata"),a=e("angular2/src/core/util/decorators");return t.Inject=a.makeParamDecorator(o.InjectMetadata),t.Optional=a.makeParamDecorator(o.OptionalMetadata),t.Injectable=a.makeDecorator(o.InjectableMetadata),t.Self=a.makeParamDecorator(o.SelfMetadata),t.Host=a.makeParamDecorator(o.HostMetadata),t.SkipSelf=a.makeParamDecorator(o.SkipSelfMetadata),n.define=i,r.exports}),System.register("angular2/src/core/facade/exceptions",["angular2/src/core/facade/exception_handler","angular2/src/core/facade/exception_handler"],!0,function(e,t,r){function n(e){return new TypeError(e)}var i=System.global,o=i.define;i.define=void 0;var a=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},s=e("angular2/src/core/facade/exception_handler"),c=e("angular2/src/core/facade/exception_handler");t.ExceptionHandler=c.ExceptionHandler;var l=function(e){function t(t){void 0===t&&(t="--"),e.call(this,t),this.message=t,this.stack=new Error(t).stack}return a(t,e),t.prototype.toString=function(){return this.message},t}(Error);t.BaseException=l;var u=function(e){function t(t,r,n,i){e.call(this,t),this._wrapperMessage=t,this._originalException=r,this._originalStack=n,this._context=i,this._wrapperStack=new Error(t).stack}return a(t,e),Object.defineProperty(t.prototype,"wrapperMessage",{get:function(){return this._wrapperMessage},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"wrapperStack",{get:function(){return this._wrapperStack},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalException",{get:function(){return this._originalException},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalStack",{get:function(){return this._originalStack},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return s.ExceptionHandler.exceptionToString(this)},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.message},t}(Error);return t.WrappedException=u,t.makeTypeError=n,i.define=o,r.exports}),System.register("angular2/src/core/reflection/reflection",["angular2/src/core/reflection/reflector","angular2/src/core/reflection/reflector","angular2/src/core/reflection/reflection_capabilities"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/reflection/reflector"),a=e("angular2/src/core/reflection/reflector");t.Reflector=a.Reflector,t.ReflectionInfo=a.ReflectionInfo;var s=e("angular2/src/core/reflection/reflection_capabilities");return t.reflector=new o.Reflector(new s.ReflectionCapabilities),n.define=i,r.exports}),System.register("angular2/src/core/di/key",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/di/type_literal","angular2/src/core/di/forward_ref","angular2/src/core/di/type_literal"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/di/type_literal"),l=e("angular2/src/core/di/forward_ref"),u=e("angular2/src/core/di/type_literal");t.TypeLiteral=u.TypeLiteral;var p=function(){function e(e,t){if(this.token=e,this.id=t,a.isBlank(e))throw new s.BaseException("Token must be defined!")}return Object.defineProperty(e.prototype,"displayName",{get:function(){return a.stringify(this.token)},enumerable:!0,configurable:!0}),e.get=function(e){return f.get(l.resolveForwardRef(e))},Object.defineProperty(e,"numberOfKeys",{get:function(){return f.numberOfKeys},enumerable:!0,configurable:!0}),e}();t.Key=p;var d=function(){function e(){this._allKeys=new Map}return e.prototype.get=function(e){if(e instanceof p)return e;var t=e;if(e instanceof c.TypeLiteral&&(t=e.type),e=t,this._allKeys.has(e))return this._allKeys.get(e);var r=new p(e,p.numberOfKeys);return this._allKeys.set(e,r),r},Object.defineProperty(e.prototype,"numberOfKeys",{get:function(){return o.MapWrapper.size(this._allKeys)},enumerable:!0,configurable:!0}),e}();t.KeyRegistry=d;var f=new d;return n.define=i,r.exports}),System.register("angular2/src/core/change_detection/change_detection_util",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/constants","angular2/src/core/change_detection/pipe_lifecycle_reflector","angular2/src/core/change_detection/binding_record","angular2/src/core/change_detection/directive_record"],!0,function(e,t,r){function n(e,t){var r=v++%20,n=y[r];return n.previousValue=e,n.currentValue=t,n}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/facade/exceptions"),c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/change_detection/constants"),u=e("angular2/src/core/change_detection/pipe_lifecycle_reflector"),p=e("angular2/src/core/change_detection/binding_record"),d=e("angular2/src/core/change_detection/directive_record"),f=function(){function e(e){this.wrapped=e}return e.wrap=function(e){var t=h[g++%5];return t.wrapped=e,t},e}();t.WrappedValue=f;var h=[new f(null),new f(null),new f(null),new f(null),new f(null)],g=0,m=function(){function e(e,t){this.previousValue=e,this.currentValue=t}return e.prototype.isFirstChange=function(){return this.previousValue===_.uninitialized},e}();t.SimpleChange=m;var v=0,y=[new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null),new m(null,null)],_=function(){function e(){}return e.arrayFn0=function(){return[]},e.arrayFn1=function(e){return[e]},e.arrayFn2=function(e,t){return[e,t]},e.arrayFn3=function(e,t,r){return[e,t,r]},e.arrayFn4=function(e,t,r,n){return[e,t,r,n]},e.arrayFn5=function(e,t,r,n,i){return[e,t,r,n,i]},e.arrayFn6=function(e,t,r,n,i,o){return[e,t,r,n,i,o]},e.arrayFn7=function(e,t,r,n,i,o,a){return[e,t,r,n,i,o,a]},e.arrayFn8=function(e,t,r,n,i,o,a,s){return[e,t,r,n,i,o,a,s]},e.arrayFn9=function(e,t,r,n,i,o,a,s,c){return[e,t,r,n,i,o,a,s,c]},e.operation_negate=function(e){return!e},e.operation_add=function(e,t){return e+t},e.operation_subtract=function(e,t){return e-t},e.operation_multiply=function(e,t){return e*t},e.operation_divide=function(e,t){return e/t},e.operation_remainder=function(e,t){return e%t},e.operation_equals=function(e,t){return e==t},e.operation_not_equals=function(e,t){return e!=t},e.operation_identical=function(e,t){return e===t},e.operation_not_identical=function(e,t){return e!==t},e.operation_less_then=function(e,t){return t>e},e.operation_greater_then=function(e,t){return e>t},e.operation_less_or_equals_then=function(e,t){return t>=e},e.operation_greater_or_equals_then=function(e,t){return e>=t},e.operation_logical_and=function(e,t){return e&&t},e.operation_logical_or=function(e,t){return e||t},e.cond=function(e,t,r){return e?t:r},e.mapFn=function(e){function t(t){for(var r=c.StringMapWrapper.create(),n=0;nt?null:e[t-1]},e.callPipeOnDestroy=function(e){u.implementsOnDestroy(e.pipe)&&e.pipe.onDestroy()},e.bindingTarget=function(e,t,r,n,i){return new p.BindingTarget(e,t,r,n,i)},e.directiveIndex=function(e,t){return new d.DirectiveIndex(e,t)},e.uninitialized=a.CONST_EXPR(new Object),e}();return t.ChangeDetectionUtil=_,i.define=o,r.exports}),System.register("angular2/src/core/profile/profile",["angular2/src/core/profile/wtf_impl"],!0,function(e,t,r){function n(e,t){return null}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/profile/wtf_impl");return t.wtfEnabled=a.detectWTF(),t.wtfCreateScope=t.wtfEnabled?a.createScope:function(e,t){return n},t.wtfLeave=t.wtfEnabled?a.leave:function(e,t){return t},t.wtfStartTimeRange=t.wtfEnabled?a.startTimeRange:function(e,t){return null},t.wtfEndTimeRange=t.wtfEnabled?a.endTimeRange:function(e){return null},i.define=o,r.exports}),System.register("angular2/src/core/change_detection/codegen_logic_util",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_record","angular2/src/core/change_detection/constants","angular2/src/core/facade/exceptions"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/collection"),a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/change_detection/codegen_facade"),c=e("angular2/src/core/change_detection/proto_record"),l=e("angular2/src/core/change_detection/constants"),u=e("angular2/src/core/facade/exceptions"),p=function(){function e(e,t,r){this._names=e,this._utilName=t,this._changeDetection=r}return e.prototype.genPropertyBindingEvalValue=function(e){var t=this;return this._genEvalValue(e,function(e){return t._names.getLocalName(e)},this._names.getLocalsAccessorName())},e.prototype.genEventBindingEvalValue=function(e,t){var r=this;return this._genEvalValue(t,function(t){return r._names.getEventLocalName(e,t)},"locals")},e.prototype._genEvalValue=function(e,t,r){var n,i=-1==e.contextIndex?this._names.getDirectiveName(e.directiveIndex):t(e.contextIndex),a=o.ListWrapper.map(e.args,function(e){return t(e)}).join(", ");switch(e.mode){case c.RecordType.Self:n=i;break;case c.RecordType.Const:n=s.codify(e.funcOrValue);break;case c.RecordType.PropertyRead:n=this._observe(i+"."+e.name,e);break;case c.RecordType.SafeProperty:var l=this._observe(i+"."+e.name,e);n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(l,e);break;case c.RecordType.PropertyWrite:n=i+"."+e.name+" = "+t(e.args[0]);break;case c.RecordType.Local:n=this._observe(r+".get("+s.rawString(e.name)+")",e);break;case c.RecordType.InvokeMethod:n=this._observe(i+"."+e.name+"("+a+")",e);break;case c.RecordType.SafeMethodInvoke:var p=i+"."+e.name+"("+a+")";n=this._utilName+".isValueBlank("+i+") ? null : "+this._observe(p,e);break;case c.RecordType.InvokeClosure:n=i+"("+a+")";break;case c.RecordType.PrimitiveOp:n=this._utilName+"."+e.name+"("+a+")";break;case c.RecordType.CollectionLiteral:n=this._utilName+"."+e.name+"("+a+")";break;case c.RecordType.Interpolate:n=this._genInterpolation(e);break;case c.RecordType.KeyedRead:n=this._observe(i+"["+t(e.args[0])+"]",e);break;case c.RecordType.KeyedWrite:n=i+"["+t(e.args[0])+"] = "+t(e.args[1]);break;case c.RecordType.Chain:n="null";break;default:throw new u.BaseException("Unknown operation "+e.mode)}return t(e.selfIndex)+" = "+n+";"},e.prototype._observe=function(e,t){return this._changeDetection===l.ChangeDetectionStrategy.OnPushObserve?"this.observeValue("+e+", "+t.selfIndex+")":e},e.prototype.genPropertyBindingTargets=function(e,t){var r=this,n=e.map(function(e){if(a.isBlank(e))return"null";var n=t?s.codify(e.debug):"null";return r._utilName+".bindingTarget("+s.codify(e.mode)+", "+e.elementIndex+", "+s.codify(e.name)+", "+s.codify(e.unit)+", "+n+")"});return"["+n.join(", ")+"]"},e.prototype.genDirectiveIndices=function(e){var t=this,r=e.map(function(e){return t._utilName+".directiveIndex("+e.directiveIndex.elementIndex+", "+e.directiveIndex.directiveIndex+")"});return"["+r.join(", ")+"]"},e.prototype._genInterpolation=function(e){for(var t=[],r=0;r=0;--r){var n=e[r];n.callAfterContentInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterContentInit();"),n.callAfterContentChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterContentChecked();")}return t},e.prototype.genViewLifecycleCallbacks=function(e){for(var t=[],r=e.length-1;r>=0;--r){var n=e[r];n.callAfterViewInit&&t.push("if(! "+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(n.directiveIndex)+".afterViewInit();"),n.callAfterViewChecked&&t.push(this._names.getDirectiveName(n.directiveIndex)+".afterViewChecked();")}return t},e}();return t.CodegenLogicUtil=p,n.define=i,r.exports}),System.register("angular2/src/core/change_detection/proto_change_detector",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/change_detection/parser/ast","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/dynamic_change_detector","angular2/src/core/change_detection/directive_record","angular2/src/core/change_detection/event_binding","angular2/src/core/change_detection/coalesce","angular2/src/core/change_detection/proto_record"],!0,function(e,t,r){function n(e){var t=new E;return g.ListWrapper.forEachWithIndex(e.bindingRecords,function(r,n){return t.add(r,e.variableNames,n)}),w.coalesce(t.records)}function i(e){var t=g.ListWrapper.concat(["$event"],e.variableNames);return e.eventRecords.map(function(e){var r=P.create(e,t),n=e.implicitReceiver instanceof _.DirectiveIndex?e.implicitReceiver:null;return new b.EventBinding(e.target.name,e.target.elementIndex,n,r)})}function o(e){switch(e){case 0:return v.ChangeDetectionUtil.arrayFn0;case 1:return v.ChangeDetectionUtil.arrayFn1;case 2:return v.ChangeDetectionUtil.arrayFn2;case 3:return v.ChangeDetectionUtil.arrayFn3;case 4:return v.ChangeDetectionUtil.arrayFn4;case 5:return v.ChangeDetectionUtil.arrayFn5;case 6:return v.ChangeDetectionUtil.arrayFn6;case 7:return v.ChangeDetectionUtil.arrayFn7;case 8:return v.ChangeDetectionUtil.arrayFn8;case 9:return v.ChangeDetectionUtil.arrayFn9;default:throw new h.BaseException("Does not support literal maps with more than 9 elements")}}function a(e){var t=g.ListWrapper.join(g.ListWrapper.map(e,function(e){return f.isString(e)?'"'+e+'"':""+e}),", ");return"mapFn(["+t+"])"}function s(e){switch(e){case"+":return"operation_add";case"-":return"operation_subtract";case"*":return"operation_multiply";case"/":return"operation_divide";case"%":return"operation_remainder";case"==":return"operation_equals";case"!=":return"operation_not_equals";case"===":return"operation_identical";case"!==":return"operation_not_identical";case"<":return"operation_less_then";case">":return"operation_greater_then";case"<=":return"operation_less_or_equals_then";case">=":return"operation_greater_or_equals_then";case"&&":return"operation_logical_and";case"||":return"operation_logical_or";default:throw new h.BaseException("Unsupported operation "+e)}}function c(e){switch(e){case"+":return v.ChangeDetectionUtil.operation_add;case"-":return v.ChangeDetectionUtil.operation_subtract;case"*":return v.ChangeDetectionUtil.operation_multiply;case"/":return v.ChangeDetectionUtil.operation_divide;case"%":return v.ChangeDetectionUtil.operation_remainder;case"==":return v.ChangeDetectionUtil.operation_equals;case"!=":return v.ChangeDetectionUtil.operation_not_equals;case"===":return v.ChangeDetectionUtil.operation_identical;case"!==":return v.ChangeDetectionUtil.operation_not_identical;case"<":return v.ChangeDetectionUtil.operation_less_then;case">":return v.ChangeDetectionUtil.operation_greater_then;case"<=":return v.ChangeDetectionUtil.operation_less_or_equals_then;case">=":return v.ChangeDetectionUtil.operation_greater_or_equals_then;case"&&":return v.ChangeDetectionUtil.operation_logical_and;case"||":return v.ChangeDetectionUtil.operation_logical_or;default:throw new h.BaseException("Unsupported operation "+e)}}function l(e){return f.isPresent(e)?""+e:""}function u(e){var t=e.length,r=t>0?e[0]:null,n=t>1?e[1]:null,i=t>2?e[2]:null,o=t>3?e[3]:null,a=t>4?e[4]:null,s=t>5?e[5]:null,c=t>6?e[6]:null,u=t>7?e[7]:null,p=t>8?e[8]:null,d=t>9?e[9]:null;switch(t-1){case 1:return function(e){return r+l(e)+n};case 2:return function(e,t){return r+l(e)+n+l(t)+i};case 3:return function(e,t,a){return r+l(e)+n+l(t)+i+l(a)+o};case 4:return function(e,t,s,c){return r+l(e)+n+l(t)+i+l(s)+o+l(c)+a};case 5:return function(e,t,c,u,p){return r+l(e)+n+l(t)+i+l(c)+o+l(u)+a+l(p)+s};case 6:return function(e,t,u,p,d,f){return r+l(e)+n+l(t)+i+l(u)+o+l(p)+a+l(d)+s+l(f)+c};case 7:return function(e,t,p,d,f,h,g){return r+l(e)+n+l(t)+i+l(p)+o+l(d)+a+l(f)+s+l(h)+c+l(g)+u};case 8:return function(e,t,d,f,h,g,m,v){return r+l(e)+n+l(t)+i+l(d)+o+l(f)+a+l(h)+s+l(g)+c+l(m)+u+l(v)+p};case 9:return function(e,t,f,h,g,m,v,y,_){return r+l(e)+n+l(t)+i+l(f)+o+l(h)+a+l(g)+s+l(m)+c+l(v)+u+l(y)+p+l(_)+d};default:throw new h.BaseException("Does not support more than 9 expressions")}}var p=System.global,d=p.define;p.define=void 0;var f=e("angular2/src/core/facade/lang"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/facade/collection"),m=e("angular2/src/core/change_detection/parser/ast"),v=e("angular2/src/core/change_detection/change_detection_util"),y=e("angular2/src/core/change_detection/dynamic_change_detector"),_=e("angular2/src/core/change_detection/directive_record"),b=e("angular2/src/core/change_detection/event_binding"),w=e("angular2/src/core/change_detection/coalesce"),C=e("angular2/src/core/change_detection/proto_record"),R=function(){function e(e){this._definition=e,this._propertyBindingRecords=n(e),this._eventBindingRecords=i(e),this._propertyBindingTargets=this._definition.bindingRecords.map(function(e){return e.target}),this._directiveIndices=this._definition.directiveRecords.map(function(e){return e.directiveIndex})}return e.prototype.instantiate=function(e){return new y.DynamicChangeDetector(this._definition.id,e,this._propertyBindingRecords.length,this._propertyBindingTargets,this._directiveIndices,this._definition.strategy,this._propertyBindingRecords,this._eventBindingRecords,this._definition.directiveRecords,this._definition.genConfig)},e}();t.DynamicProtoChangeDetector=R,t.createPropertyRecords=n,t.createEventRecords=i;var E=function(){function e(){this.records=[]}return e.prototype.add=function(e,t,r){var n=g.ListWrapper.last(this.records);f.isPresent(n)&&n.bindingRecord.directiveRecord==e.directiveRecord&&(n.lastInDirective=!1);var i=this.records.length;this._appendRecords(e,t,r);var o=g.ListWrapper.last(this.records);f.isPresent(o)&&o!==n&&(o.lastInBinding=!0,o.lastInDirective=!0,this._setArgumentToPureFunction(i))},e.prototype._setArgumentToPureFunction=function(e){for(var t=this,r=e;r0?r[0]:"mediumDate";return s.isNumber(t)&&(t=s.DateWrapper.fromMillis(t)),p.StringMapWrapper.contains(e._ALIASES,n)&&(n=p.StringMapWrapper.get(e._ALIASES,n)),c.DateFormatter.format(t,f,n)},e.prototype.supports=function(e){return s.isDate(e)||s.isNumber(e)},e._ALIASES={medium:"yMMMdjms","short":"yMdjm",fullDate:"yMMMMEEEEd",longDate:"yMMMMd",mediumDate:"yMMMd",shortDate:"yMd",mediumTime:"jms",shortTime:"jm"},e=o([s.CONST(),u.Pipe({name:"date"}),l.Injectable(),a("design:paramtypes",[])],e)}();return t.DatePipe=h,n.define=i,r.exports}),System.register("angular2/src/core/pipes/default_pipes",["angular2/src/core/pipes/async_pipe","angular2/src/core/pipes/uppercase_pipe","angular2/src/core/pipes/lowercase_pipe","angular2/src/core/pipes/json_pipe","angular2/src/core/pipes/slice_pipe","angular2/src/core/pipes/date_pipe","angular2/src/core/pipes/number_pipe","angular2/src/core/facade/lang","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/pipes/async_pipe"),a=e("angular2/src/core/pipes/uppercase_pipe"),s=e("angular2/src/core/pipes/lowercase_pipe"),c=e("angular2/src/core/pipes/json_pipe"),l=e("angular2/src/core/pipes/slice_pipe"),u=e("angular2/src/core/pipes/date_pipe"),p=e("angular2/src/core/pipes/number_pipe"),d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/di"),h=d.CONST_EXPR([o.AsyncPipe,a.UpperCasePipe,s.LowerCasePipe,c.JsonPipe,l.SlicePipe,p.DecimalPipe,p.PercentPipe,p.CurrencyPipe,u.DatePipe]);return t.DEFAULT_PIPES_TOKEN=d.CONST_EXPR(new f.OpaqueToken("Default Pipes")),t.DEFAULT_PIPES=d.CONST_EXPR(new f.Binding(t.DEFAULT_PIPES_TOKEN,{toValue:h})),n.define=i,r.exports}),System.register("angular2/src/core/forms/model",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/facade/collection","angular2/src/core/forms/validators"],!0,function(e,t,r){function n(e){return e instanceof d}function i(e,t){return c.isBlank(t)?null:(t instanceof Array||(t=t.split("/")),t instanceof Array&&u.ListWrapper.isEmpty(t)?null:u.ListWrapper.reduce(t,function(e,t){if(e instanceof h)return c.isPresent(e.controls[t])?e.controls[t]:null;if(e instanceof g){var r=t;return c.isPresent(e.at(r))?e.at(r):null}return null},e))}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/core/facade/async"),u=e("angular2/src/core/facade/collection"),p=e("angular2/src/core/forms/validators");t.VALID="VALID",t.INVALID="INVALID",t.isControl=n;var d=function(){function e(e){this.validator=e,this._pristine=!0,this._touched=!1}return Object.defineProperty(e.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this._status},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valid",{get:function(){return this._status===t.VALID},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errors",{get:function(){return this._errors},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pristine",{get:function(){return this._pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dirty",{get:function(){return!this.pristine},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touched",{get:function(){return this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"untouched",{get:function(){return!this._touched},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueChanges",{get:function(){return this._valueChanges},enumerable:!0,configurable:!0}),e.prototype.markAsTouched=function(){this._touched=!0},e.prototype.markAsDirty=function(e){var t=(void 0===e?{}:e).onlySelf;t=c.normalizeBool(t),this._pristine=!1,c.isPresent(this._parent)&&!t&&this._parent.markAsDirty({onlySelf:t})},e.prototype.setParent=function(e){this._parent=e},e.prototype.updateValidity=function(e){var r=(void 0===e?{}:e).onlySelf;r=c.normalizeBool(r),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!r&&this._parent.updateValidity({onlySelf:r})},e.prototype.updateValueAndValidity=function(e){var r=void 0===e?{}:e,n=r.onlySelf,i=r.emitEvent;n=c.normalizeBool(n),i=c.isPresent(i)?i:!0,this._updateValue(),i&&l.ObservableWrapper.callNext(this._valueChanges,this._value),this._errors=this.validator(this),this._status=c.isPresent(this._errors)?t.INVALID:t.VALID,c.isPresent(this._parent)&&!n&&this._parent.updateValueAndValidity({onlySelf:n,emitEvent:i})},e.prototype.find=function(e){return i(this,e)},e.prototype.getError=function(e,t){void 0===t&&(t=null);var r=c.isPresent(t)&&!u.ListWrapper.isEmpty(t)?this.find(t):this;return c.isPresent(r)&&c.isPresent(r._errors)?u.StringMapWrapper.get(r._errors,e):null},e.prototype.hasError=function(e,t){return void 0===t&&(t=null),c.isPresent(this.getError(e,t))},e.prototype._updateValue=function(){},e}();t.AbstractControl=d;var f=function(e){function t(t,r){void 0===t&&(t=null),void 0===r&&(r=p.Validators.nullValidator),e.call(this,r),this._value=t,this.updateValidity({onlySelf:!0}),this._valueChanges=new l.EventEmitter}return s(t,e),t.prototype.updateValue=function(e,t){var r=void 0===t?{}:t,n=r.onlySelf,i=r.emitEvent,o=r.emitModelToViewChange;o=c.isPresent(o)?o:!0,this._value=e,c.isPresent(this._onChange)&&o&&this._onChange(this._value),this.updateValueAndValidity({onlySelf:n,emitEvent:i})},t.prototype.registerOnChange=function(e){this._onChange=e},t}(d);t.Control=f;var h=function(e){function t(t,r,n){void 0===r&&(r=null),void 0===n&&(n=p.Validators.group),e.call(this,n),this.controls=t,this._optionals=c.isPresent(r)?r:{},this._valueChanges=new l.EventEmitter,this._setParentForControls(),this._value=this._reduceValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.addControl=function(e,t){this.controls[e]=t,t.setParent(this)},t.prototype.removeControl=function(e){u.StringMapWrapper["delete"](this.controls,e)},t.prototype.include=function(e){u.StringMapWrapper.set(this._optionals,e,!0),this.updateValueAndValidity()},t.prototype.exclude=function(e){u.StringMapWrapper.set(this._optionals,e,!1),this.updateValueAndValidity()},t.prototype.contains=function(e){var t=u.StringMapWrapper.contains(this.controls,e);return t&&this._included(e)},t.prototype._setParentForControls=function(){var e=this;u.StringMapWrapper.forEach(this.controls,function(t,r){t.setParent(e)})},t.prototype._updateValue=function(){this._value=this._reduceValue()},t.prototype._reduceValue=function(){return this._reduceChildren({},function(e,t,r){return e[r]=t.value,e})},t.prototype._reduceChildren=function(e,t){var r=this,n=e;return u.StringMapWrapper.forEach(this.controls,function(e,i){r._included(i)&&(n=t(n,e,i))}),n},t.prototype._included=function(e){var t=u.StringMapWrapper.contains(this._optionals,e);return!t||u.StringMapWrapper.get(this._optionals,e)},t}(d);t.ControlGroup=h;var g=function(e){function t(t,r){void 0===r&&(r=p.Validators.array),e.call(this,r),this.controls=t,this._valueChanges=new l.EventEmitter,this._setParentForControls(),this._updateValue(),this.updateValidity({onlySelf:!0})}return s(t,e),t.prototype.at=function(e){return this.controls[e]},t.prototype.push=function(e){this.controls.push(e),e.setParent(this),this.updateValueAndValidity()},t.prototype.insert=function(e,t){u.ListWrapper.insert(this.controls,e,t),t.setParent(this),this.updateValueAndValidity()},t.prototype.removeAt=function(e){u.ListWrapper.removeAt(this.controls,e),this.updateValueAndValidity()},Object.defineProperty(t.prototype,"length",{get:function(){return this.controls.length},enumerable:!0,configurable:!0}),t.prototype._updateValue=function(){this._value=this.controls.map(function(e){return e.value})},t.prototype._setParentForControls=function(){var e=this;this.controls.forEach(function(t){t.setParent(e)})},t}(d);return t.ControlArray=g,o.define=a,r.exports}),System.register("angular2/src/core/forms/directives/ng_control_name",["angular2/src/core/facade/lang","angular2/src/core/facade/async","angular2/src/core/metadata","angular2/src/core/di","angular2/src/core/forms/directives/control_container","angular2/src/core/forms/directives/ng_control","angular2/src/core/forms/directives/shared","angular2/src/core/forms/validators"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/metadata"),d=e("angular2/src/core/di"),f=e("angular2/src/core/forms/directives/control_container"),h=e("angular2/src/core/forms/directives/ng_control"),g=e("angular2/src/core/forms/directives/shared"),m=e("angular2/src/core/forms/validators"),v=l.CONST_EXPR(new d.Binding(h.NgControl,{toAlias:d.forwardRef(function(){return y})})),y=function(e){function t(t,r){e.call(this),this.update=new u.EventEmitter,this._added=!1,this._parent=t,this.validators=r}return o(t,e),t.prototype.onChanges=function(e){this._added||(this.formDirective.addControl(this),this._added=!0),g.isPropertyUpdated(e,this.viewModel)&&(this.viewModel=this.model,this.formDirective.updateModel(this,this.model))},t.prototype.onDestroy=function(){this.formDirective.removeControl(this)},t.prototype.viewToModelUpdate=function(e){this.viewModel=e,u.ObservableWrapper.callNext(this.update,e)},Object.defineProperty(t.prototype,"path",{get:function(){return g.controlPath(this.name,this._parent)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"formDirective",{get:function(){return this._parent.formDirective},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this.formDirective.getControl(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"validator",{get:function(){return m.Validators.compose(this.validators)},enumerable:!0,configurable:!0}),t=a([p.Directive({selector:"[ng-control]",bindings:[v],properties:["name: ngControl","model: ngModel"],events:["update: ngModel"],exportAs:"form"}),c(0,d.Host()),c(0,d.SkipSelf()),c(1,d.Optional()),c(1,d.Inject(m.NG_VALIDATORS)),s("design:paramtypes",[f.ControlContainer,Array])],t)}(h.NgControl);return t.NgControlName=y,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/util",["angular2/src/core/facade/lang","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/collection"],!0,function(e,t,r){function n(e){return h.StringWrapper.replaceAllMapped(e,v,function(e){return"-"+e[1].toLowerCase()})}function i(e){return h.StringWrapper.replaceAllMapped(e,y,function(e){return e[1].toUpperCase()})}function o(e,r){var n,i,o=0;if(r){var a=g.DOM.firstChild(e),s=g.DOM.hasClass(a,t.NG_BINDING_CLASS);i=g.DOM.getElementsByClassName(a,t.NG_BINDING_CLASS),n=m.ListWrapper.createFixedSize(i.length+(s?1:0)),s&&(n[o++]=a)}else i=g.DOM.querySelectorAll(e,t.NG_BINDING_CLASS_SELECTOR),n=m.ListWrapper.createFixedSize(i.length);for(var c=0;c=1&&(n=g.DOM.nextSibling(n));for(var a=0;a0)for(var s=g.DOM.childNodes(e),c=0;c0)for(var p=g.DOM.childNodes(u),d=0;d0?r:null}function o(e,t){return g.isBlank(t)?e:"@media "+t+" {\n"+e+"\n}"}var a=System.global,s=a.define;a.define=void 0;var c=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},l=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},u=e("angular2/src/core/di"),p=e("angular2/src/core/render/xhr"),d=e("angular2/src/core/facade/collection"),f=e("angular2/src/core/services/url_resolver"),h=e("angular2/src/core/render/dom/compiler/style_url_resolver"),g=e("angular2/src/core/facade/lang"),m=e("angular2/src/core/facade/async"),v=function(){function e(e,t,r){this._xhr=e,this._styleUrlResolver=t,this._urlResolver=r}return e.prototype.inlineImports=function(e,t){return this._inlineImports(e,t,[])},e.prototype._inlineImports=function(e,t,r){var o=this,a=0,s=g.StringWrapper.split(e,y);if(1===s.length)return e;for(var c=[];a' element";throw l.isPresent(a)&&(h+=" and there are no matching directives with a corresponding property"),new u.BaseException(h)}s.push(f)}}),s}function i(e,t,r,n){return n.type===m.PropertyBindingType.PROPERTY?r?d.DOM.hasProperty(t,n.property):e.hasProperty(d.DOM.tagName(t),n.property):!0}function o(e,t,r){var n=r.split(".");if(1===n.length){var i=e.getMappedPropName(n[0]);return new m.ElementPropertyBinding(m.PropertyBindingType.PROPERTY,t,i)}if(n[0]==R)return new m.ElementPropertyBinding(m.PropertyBindingType.ATTRIBUTE,t,n[1]);if(n[0]==E)return new m.ElementPropertyBinding(m.PropertyBindingType.CLASS,t,v.camelCaseToDashCase(n[1]));if(n[0]==P){var o=n.length>2?n[2]:null;return new m.ElementPropertyBinding(m.PropertyBindingType.STYLE,t,n[1],o)}throw new u.BaseException("Invalid property name "+r)}var a=System.global,s=a.define;a.define=void 0;var c=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/dom/dom_adapter"),f=e("angular2/src/core/change_detection/change_detection"),h=e("angular2/src/core/render/dom/view/proto_view"),g=e("angular2/src/core/render/dom/view/element_binder"),m=e("angular2/src/core/render/api"),v=e("angular2/src/core/render/dom/util"),y=e("angular2/src/core/render/event_config"),_=function(){function e(e,t,r){this.rootElement=e,this.type=t,this.viewEncapsulation=r,this.variableBindings=new Map,this.elements=[],this.rootTextBindings=new Map,this.ngContentCount=0,this.hostAttributes=new Map}return e.prototype.bindElement=function(e,t){void 0===t&&(t=null);var r=new b(this.elements.length,e,t);return this.elements.push(r),d.DOM.addClass(e,v.NG_BINDING_CLASS),r},e.prototype.bindVariable=function(e,t){this.variableBindings.set(t,e)},e.prototype.bindRootText=function(e,t){this.rootTextBindings.set(e,t)},e.prototype.bindNgContent=function(){this.ngContentCount++},e.prototype.setHostAttribute=function(e,t){this.hostAttributes.set(e,t)},e.prototype.build=function(e,t){var r=[],i=[],o=[],a=[],s=this.ngContentCount;v.queryBoundTextNodeIndices(d.DOM.content(this.rootElement),this.rootTextBindings,function(e,t,r){o.push(r),a.push(t)}),p.ListWrapper.forEach(this.elements,function(a){var c=new p.Set,u=p.ListWrapper.map(a.directives,function(t){return a.eventBuilder.merge(t.eventBuilder),p.ListWrapper.forEach(t.templatePropertyNames,function(e){return c.add(e)}),new m.DirectiveBinder({directiveIndex:t.directiveIndex,propertyBindings:t.propertyBindings,eventBindings:t.eventBindings,hostPropertyBindings:n(e,a.element,!0,t.hostPropertyBindings,null)})}),d=l.isPresent(a.nestedProtoView)?a.nestedProtoView.build(e,t):null;l.isPresent(d)&&(s+=d.transitiveNgContentCount);var h=l.isPresent(a.parent)?a.parent.index:-1,y=[];v.queryBoundTextNodeIndices(a.element,a.textBindings,function(e,t,r){o.push(r),y.push(t)}),i.push(new m.RenderElementBinder({index:a.index,parentIndex:h,distanceToParent:a.distanceToParent,directives:u,nestedProtoView:d,propertyBindings:n(e,a.element,l.isPresent(a.componentId),a.propertyBindings,c),variableBindings:a.variableBindings,eventBindings:a.eventBindings,readAttributes:a.readAttributes})),r.push(new g.DomElementBinder({textNodeIndices:y,hasNestedProtoView:l.isPresent(d)||l.isPresent(a.componentId),hasNativeShadowRoot:!1,eventLocals:new f.LiteralArray(a.eventBuilder.buildEventLocals()),localEvents:a.eventBuilder.buildLocalEvents(),globalEvents:a.eventBuilder.buildGlobalEvents()}))});var c=d.DOM.childNodes(d.DOM.content(this.rootElement)).length;return new m.ProtoViewDto({render:new h.DomProtoViewRef(h.DomProtoView.create(t,this.type,this.rootElement,this.viewEncapsulation,[c],a,r,this.hostAttributes)),type:this.type,elementBinders:i,variableBindings:this.variableBindings,textBindings:o,transitiveNgContentCount:s})},e}();t.ProtoViewBuilder=_;var b=function(){function e(e,t,r){this.index=e,this.element=t,this.parent=null,this.distanceToParent=0,this.directives=[],this.nestedProtoView=null,this.propertyBindings=new Map,this.variableBindings=new Map,this.eventBindings=[],this.eventBuilder=new C,this.textBindings=new Map,this.readAttributes=new Map,this.componentId=null}return e.prototype.setParent=function(e,t){return this.parent=e,l.isPresent(e)&&(this.distanceToParent=t),this},e.prototype.readAttribute=function(e){l.isBlank(this.readAttributes.get(e))&&this.readAttributes.set(e,d.DOM.getAttribute(this.element,e))},e.prototype.bindDirective=function(e){var t=new w(e);return this.directives.push(t),t},e.prototype.bindNestedProtoView=function(e){if(l.isPresent(this.nestedProtoView))throw new u.BaseException("Only one nested view per element is allowed");return this.nestedProtoView=new _(e,m.ViewType.EMBEDDED,m.ViewEncapsulation.None),this.nestedProtoView},e.prototype.bindProperty=function(e,t){this.propertyBindings.set(e,t)},e.prototype.bindVariable=function(e,t){l.isPresent(this.nestedProtoView)?this.nestedProtoView.bindVariable(e,t):this.variableBindings.set(t,e)},e.prototype.bindEvent=function(e,t,r){void 0===r&&(r=null),this.eventBindings.push(this.eventBuilder.add(e,t,r))},e.prototype.bindText=function(e,t){this.textBindings.set(e,t)},e.prototype.setComponentId=function(e){this.componentId=e},e}();t.ElementBinderBuilder=b;var w=function(){function e(e){this.directiveIndex=e,this.propertyBindings=new Map,this.templatePropertyNames=[],this.hostPropertyBindings=new Map,this.eventBindings=[],this.eventBuilder=new C}return e.prototype.bindProperty=function(e,t,r){this.propertyBindings.set(e,t),l.isPresent(r)&&this.templatePropertyNames.push(r)},e.prototype.bindHostProperty=function(e,t){this.hostPropertyBindings.set(e,t)},e.prototype.bindEvent=function(e,t,r){void 0===r&&(r=null),this.eventBindings.push(this.eventBuilder.add(e,t,r))},e}();t.DirectiveBuilder=w;var C=function(e){function t(){e.call(this),this.locals=[],this.localEvents=[],this.globalEvents=[],this._implicitReceiver=new f.ImplicitReceiver}return c(t,e),t.prototype.add=function(e,t,r){var n=t.ast,i=l.isPresent(r)?r+y.EVENT_TARGET_SEPARATOR+e:e,o=new m.EventBinding(i,new f.ASTWithSource(n,t.source,t.location)),a=new g.Event(e,r,i);return l.isBlank(r)?this.localEvents.push(a):this.globalEvents.push(a),o},t.prototype.visitPropertyRead=function(e){for(var t=!1,r=e;!t&&r instanceof f.PropertyRead;){var n=r;"$event"==n.name&&(t=!0),r=n.receiver}if(t){this.locals.push(e);var i=this.locals.length-1;return new f.PropertyRead(this._implicitReceiver,""+i,function(e){return e[i]})}return e},t.prototype.buildEventLocals=function(){return this.locals},t.prototype.buildLocalEvents=function(){return this.localEvents},t.prototype.buildGlobalEvents=function(){return this.globalEvents}, +t.prototype.merge=function(e){this._merge(this.localEvents,e.localEvents),this._merge(this.globalEvents,e.globalEvents),this.locals.concat(e.locals)},t.prototype._merge=function(e,t){for(var r=[],n=0;n-1?(n=o.StringWrapper.substring(e,0,c).trim(),a=this._splitBindConfig(o.StringWrapper.substring(e,c+1)),i=s.ListWrapper.removeAt(a,0)):(n=e,i=e,a=[]),i=p.dashCaseToCamelCase(i);var l=t.bindElement().propertyBindings.get(i);if(o.isBlank(l)){var u=t.attrs().get(p.camelCaseToDashCase(i));o.isPresent(u)&&(l=this._parser.wrapLiteralPrimitive(u,t.elementDescription))}o.isPresent(l)&&r.bindProperty(n,l,i)},e.prototype._bindDirectiveEvent=function(e,t,r,n){var i=this._parser.parseAction(t,r.elementDescription),o=d.EventConfig.parse(e),a=o.isLongForm?o.fieldName:null;n.bindEvent(o.eventName,i,a)},e.prototype._bindHostProperty=function(e,t,r,n){var i=this._parser.parseSimpleBinding(t,"hostProperties of "+r.elementDescription);n.bindHostProperty(e,i)},e.prototype._addHostAttribute=function(e,t,r){o.StringWrapper.equals(e,"class")?s.ListWrapper.forEach(t.split(" "),function(e){c.DOM.addClass(r.element,e)}):c.DOM.hasAttribute(r.element,e)||c.DOM.setAttribute(r.element,e,t)},e.prototype._splitBindConfig=function(e){return s.ListWrapper.map(e.split("|"),function(e){return e.trim()})},e}();return t.DirectiveParser=f,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/style_encapsulator",["angular2/src/core/render/api","angular2/src/core/render/dom/util","angular2/src/core/dom/dom_adapter","angular2/src/core/facade/lang","angular2/src/core/render/dom/compiler/shadow_css"],!0,function(e,t,r){function n(e){return"_nghost-"+e}function i(e){return"_ngcontent-"+e}var o=System.global,a=o.define;o.define=void 0;var s=e("angular2/src/core/render/api"),c=e("angular2/src/core/render/dom/util"),l=e("angular2/src/core/dom/dom_adapter"),u=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/render/dom/compiler/shadow_css"),d=function(){function e(e,t,r){this._appId=e,this._view=t,this._componentUIDsCache=r}return e.prototype.processElement=function(e,t,r){c.isElementWithTag(t.element,c.NG_CONTENT_ELEMENT_NAME)?t.inheritedProtoView.bindNgContent():this._view.encapsulation===s.ViewEncapsulation.Emulated&&this._processEmulatedScopedElement(t,e)},e.prototype.processStyle=function(e){var t=this._view.encapsulation;return t===s.ViewEncapsulation.Emulated?this._shimCssForComponent(e,this._view.componentId):e},e.prototype._processEmulatedScopedElement=function(e,t){var r=e.element,o=this._view.componentId,a=e.inheritedProtoView.type;if(a!==s.ViewType.HOST&&u.isPresent(o)){var c=i(this._getComponentId(o));if(l.DOM.setAttribute(r,c,""),u.isBlank(t)&&a==s.ViewType.COMPONENT){var p=n(this._getComponentId(o));e.inheritedProtoView.setHostAttribute(p,"")}}},e.prototype._shimCssForComponent=function(e,t){var r=this._getComponentId(t),o=new p.ShadowCss;return o.shimCssText(e,i(r),n(r))},e.prototype._getComponentId=function(e){var t=this._componentUIDsCache.get(e);return u.isBlank(t)&&(t=this._appId+"-"+this._componentUIDsCache.size,this._componentUIDsCache.set(e,t)),t},e}();return t.StyleEncapsulator=d,o.define=a,r.exports}),System.register("angular2/src/animate/animation",["angular2/src/core/facade/lang","angular2/src/core/facade/math","angular2/src/core/render/dom/util","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/math"),s=e("angular2/src/core/render/dom/util"),c=e("angular2/src/core/facade/collection"),l=e("angular2/src/core/dom/dom_adapter"),u=function(){function e(e,t,r){var n=this;this.element=e,this.data=t,this.browserDetails=r,this.callbacks=[],this.eventClearFunctions=[],this.completed=!1,this._stringPrefix="",this.startTime=o.DateWrapper.toMillis(o.DateWrapper.now()),this._stringPrefix=l.DOM.getAnimationPrefix(),this.setup(),this.wait(function(e){return n.start()})}return Object.defineProperty(e.prototype,"totalTime",{get:function(){var e=null!=this.computedDelay?this.computedDelay:0,t=null!=this.computedDuration?this.computedDuration:0;return e+t},enumerable:!0,configurable:!0}),e.prototype.wait=function(e){this.browserDetails.raf(e,2)},e.prototype.setup=function(){null!=this.data.fromStyles&&this.applyStyles(this.data.fromStyles),null!=this.data.duration&&this.applyStyles({transitionDuration:this.data.duration.toString()+"ms"}),null!=this.data.delay&&this.applyStyles({transitionDelay:this.data.delay.toString()+"ms"})},e.prototype.start=function(){this.addClasses(this.data.classesToAdd),this.addClasses(this.data.animationClasses),this.removeClasses(this.data.classesToRemove),null!=this.data.toStyles&&this.applyStyles(this.data.toStyles);var e=l.DOM.getComputedStyle(this.element);this.computedDelay=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-delay")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-delay"))),this.computedDuration=a.Math.max(this.parseDurationString(e.getPropertyValue(this._stringPrefix+"transition-duration")),this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix+"transition-duration"))),this.addEvents()},e.prototype.applyStyles=function(e){var t=this;c.StringMapWrapper.forEach(e,function(e,r){var n=s.camelCaseToDashCase(r);o.isPresent(l.DOM.getStyle(t.element,n))?l.DOM.setStyle(t.element,n,e.toString()):l.DOM.setStyle(t.element,t._stringPrefix+n,e.toString())})},e.prototype.addClasses=function(e){for(var t=0,r=e.length;r>t;t++)l.DOM.addClass(this.element,e[t])},e.prototype.removeClasses=function(e){for(var t=0,r=e.length;r>t;t++)l.DOM.removeClass(this.element,e[t])},e.prototype.addEvents=function(){var e=this;this.totalTime>0?this.eventClearFunctions.push(l.DOM.onAndCancel(this.element,l.DOM.getTransitionEnd(),function(t){return e.handleAnimationEvent(t)})):this.handleAnimationCompleted()},e.prototype.handleAnimationEvent=function(e){var t=a.Math.round(1e3*e.elapsedTime);this.browserDetails.elapsedTimeIncludesDelay||(t+=this.computedDelay),e.stopPropagation(),t>=this.totalTime&&this.handleAnimationCompleted()},e.prototype.handleAnimationCompleted=function(){this.removeClasses(this.data.animationClasses),this.callbacks.forEach(function(e){return e()}),this.callbacks=[],this.eventClearFunctions.forEach(function(e){return e()}),this.eventClearFunctions=[],this.completed=!0},e.prototype.onComplete=function(e){return this.completed?e():this.callbacks.push(e),this},e.prototype.parseDurationString=function(e){var t=0;if(null==e||e.length<2)return t;if("ms"==e.substring(e.length-2)){var r=o.NumberWrapper.parseInt(this.stripLetters(e),10);r>t&&(t=r)}else if("s"==e.substring(e.length-1)){var n=1e3*o.NumberWrapper.parseFloat(this.stripLetters(e)),r=a.Math.floor(n);r>t&&(t=r)}return t},e.prototype.stripLetters=function(e){return o.StringWrapper.replaceAll(e,o.RegExpWrapper.create("[^0-9]+$",""),"")},e}();return t.Animation=u,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/events/event_manager",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/dom/dom_adapter","angular2/src/core/zone/ng_zone","angular2/src/core/di"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/facade/lang"),u=e("angular2/src/core/facade/exceptions"),p=e("angular2/src/core/facade/collection"),d=e("angular2/src/core/dom/dom_adapter"),f=e("angular2/src/core/zone/ng_zone"),h=e("angular2/src/core/di");t.EVENT_MANAGER_PLUGINS=l.CONST_EXPR(new h.OpaqueToken("EventManagerPlugins"));var g=function(){function e(e,t){var r=this;this._zone=t,e.forEach(function(e){return e.manager=r}),this._plugins=p.ListWrapper.reversed(e)}return e.prototype.addEventListener=function(e,t,r){var n=this._findPluginFor(t);n.addEventListener(e,t,r)},e.prototype.addGlobalEventListener=function(e,t,r){var n=this._findPluginFor(t);return n.addGlobalEventListener(e,t,r)},e.prototype.getZone=function(){return this._zone},e.prototype._findPluginFor=function(e){for(var t=this._plugins,r=0;r #text("+n+"):nth-child("+t+")")}function i(e,t,r,n){return new h.HtmlAttrAst(r,n,t+"["+r+"="+n+"]")}function o(e,t,r){var n=f.DOM.nodeName(e).toLowerCase(),i=r+" > "+n+":nth-child("+t+")",o=a(e,i),c=s(e,i);return new h.HtmlElementAst(n,o,c,i)}function a(e,t){var r=f.DOM.attributeMap(e),n=[];return r.forEach(function(e,t){return n.push([t,e])}),n.sort(function(e,t){return d.StringWrapper.compare(e[0],t[0])}),n.map(function(r){return i(e,t,r[0],r[1])})}function s(e,t){var r=f.DOM.templateAwareRoot(e),i=f.DOM.childNodesAsList(r),a=[],s=0;return i.forEach(function(e){var r=null;if(f.DOM.isTextNode(e)){var i=e;r=n(i,s,t)}else if(f.DOM.isElementNode(e)){var c=e;r=o(c,s,t)}d.isPresent(r)&&a.push(r),s++}),a}var c=System.global,l=c.define;c.define=void 0;var u=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},p=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},d=e("angular2/src/core/facade/lang"),f=e("angular2/src/core/dom/dom_adapter"),h=e("angular2/src/compiler/html_ast"),g=e("angular2/src/compiler/util"),m=e("angular2/src/core/di"),v=function(){function e(){}return e.prototype.parse=function(e,t){var r=f.DOM.createTemplate(e);return s(r,t)},e.prototype.unparse=function(e){var t=new y,r=[];return h.htmlVisitAll(t,e,r),r.join("")},e=u([m.Injectable(),p("design:paramtypes",[])],e)}();t.HtmlParser=v;var y=function(){function e(){}return e.prototype.visitElement=function(e,t){t.push("<"+e.name);var r=[];return h.htmlVisitAll(this,e.attrs,r),e.attrs.length>0&&(t.push(" "),t.push(r.join(" "))),t.push(">"),h.htmlVisitAll(this,e.children,t),t.push(""),null},e.prototype.visitAttr=function(e,t){return t.push(e.name+"="+g.escapeDoubleQuoteString(e.value)),null},e.prototype.visitText=function(e,t){return t.push(e.value),null},e}();return c.define=l,r.exports}),System.register("angular2/src/core/directives",["angular2/src/core/facade/lang","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_non_bindable","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/ng_class","angular2/src/core/directives/ng_for","angular2/src/core/directives/ng_if","angular2/src/core/directives/ng_non_bindable","angular2/src/core/directives/ng_style","angular2/src/core/directives/ng_switch","angular2/src/core/directives/observable_list_diff"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0;var a=e("angular2/src/core/facade/lang"),s=e("angular2/src/core/directives/ng_class"),c=e("angular2/src/core/directives/ng_for"),l=e("angular2/src/core/directives/ng_if"),u=e("angular2/src/core/directives/ng_non_bindable"),p=e("angular2/src/core/directives/ng_style"),d=e("angular2/src/core/directives/ng_switch"),f=e("angular2/src/core/directives/ng_class");t.NgClass=f.NgClass;var h=e("angular2/src/core/directives/ng_for");t.NgFor=h.NgFor;var g=e("angular2/src/core/directives/ng_if");t.NgIf=g.NgIf;var m=e("angular2/src/core/directives/ng_non_bindable");t.NgNonBindable=m.NgNonBindable;var v=e("angular2/src/core/directives/ng_style");t.NgStyle=v.NgStyle;var y=e("angular2/src/core/directives/ng_switch");return t.NgSwitch=y.NgSwitch,t.NgSwitchWhen=y.NgSwitchWhen,t.NgSwitchDefault=y.NgSwitchDefault,n(e("angular2/src/core/directives/observable_list_diff")),t.CORE_DIRECTIVES=a.CONST_EXPR([s.NgClass,c.NgFor,l.NgIf,u.NgNonBindable,p.NgStyle,d.NgSwitch,d.NgSwitchWhen,d.NgSwitchDefault]),i.define=o,r.exports}),System.register("angular2/src/core/debug",["angular2/src/core/debug/debug_element","angular2/src/core/debug/debug_element_view_listener"],!0,function(e,t,r){function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}var i=System.global,o=i.define;i.define=void 0,n(e("angular2/src/core/debug/debug_element"));var a=e("angular2/src/core/debug/debug_element_view_listener");return t.inspectNativeElement=a.inspectNativeElement,t.ELEMENT_PROBE_BINDINGS=a.ELEMENT_PROBE_BINDINGS,i.define=o,r.exports}),System.register("angular2/src/http/interfaces",["angular2/src/core/facade/exceptions","angular2/src/http/url_search_params"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/exceptions"),a=e("angular2/src/http/url_search_params"),s=(a.URLSearchParamsUnionFixer,function(){function e(){}return e.prototype.createConnection=function(e){throw new o.BaseException("Abstract!")},e}());t.ConnectionBackend=s;var c=function(){function e(){}return e.prototype.dispose=function(){throw new o.BaseException("Abstract!")},e}();return t.Connection=c,n.define=i,r.exports}),System.register("angular2/src/http/static_request",["angular2/src/http/headers","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/http/headers"),a=e("angular2/src/core/facade/lang"),s=function(){function e(e){var t=e.url;if(this.url=e.url,a.isPresent(e.search)){var r=e.search.toString();if(r.length>0){var n="?";a.StringWrapper.contains(this.url,"?")&&(n="&"==this.url[this.url.length-1]?"":"&"),this.url=t+n+r}}this._body=e.body,this.method=e.method,this.headers=new o.Headers(e.headers)}return e.prototype.text=function(){return a.isPresent(this._body)?this._body.toString():""},e}();return t.Request=s,n.define=i,r.exports}),System.register("angular2/src/http/base_request_options",["angular2/src/core/facade/lang","angular2/src/http/headers","angular2/src/http/enums","angular2/src/core/di","angular2/src/http/url_search_params"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=e("angular2/src/core/facade/lang"),l=e("angular2/src/http/headers"),u=e("angular2/src/http/enums"),p=e("angular2/src/core/di"),d=e("angular2/src/http/url_search_params"),f=function(){function e(e){var t=void 0===e?{}:e,r=t.method,n=t.headers,i=t.body,o=t.url,a=t.search;this.method=c.isPresent(r)?r:null,this.headers=c.isPresent(n)?n:null,this.body=c.isPresent(i)?i:null,this.url=c.isPresent(o)?o:null,this.search=c.isPresent(a)?c.isString(a)?new d.URLSearchParams(a):a:null}return e.prototype.merge=function(t){return new e({method:c.isPresent(t)&&c.isPresent(t.method)?t.method:this.method,headers:c.isPresent(t)&&c.isPresent(t.headers)?t.headers:this.headers,body:c.isPresent(t)&&c.isPresent(t.body)?t.body:this.body,url:c.isPresent(t)&&c.isPresent(t.url)?t.url:this.url,search:c.isPresent(t)&&c.isPresent(t.search)?c.isString(t.search)?new d.URLSearchParams(t.search):t.search.clone():this.search})},e}();t.RequestOptions=f;var h=function(e){function t(){e.call(this,{method:u.RequestMethods.Get,headers:new l.Headers})}return o(t,e),t=a([p.Injectable(),s("design:paramtypes",[])],t)}(f);return t.BaseRequestOptions=h,n.define=i,r.exports}),System.register("angular2/src/http/static_response",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/http/http_utils"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/http/http_utils"),c=function(){function e(e){this._body=e.body,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,this.type=e.type,this.url=e.url}return e.prototype.blob=function(){throw new a.BaseException('"blob()" method not implemented on Response superclass')},e.prototype.json=function(){var e;return s.isJsObject(this._body)?e=this._body:o.isString(this._body)&&(e=o.Json.parse(this._body)),e},e.prototype.text=function(){return this._body.toString()},e.prototype.arrayBuffer=function(){throw new a.BaseException('"arrayBuffer()" method not implemented on Response superclass')},e}();return t.Response=c,n.define=i,r.exports}),System.register("angular2/src/http/backends/jsonp_backend",["angular2/src/http/enums","angular2/src/http/static_response","angular2/src/http/base_response_options","angular2/src/core/di","angular2/src/http/backends/browser_jsonp","angular2/src/core/facade/async","angular2/src/core/facade/exceptions","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/http/enums"),c=e("angular2/src/http/static_response"),l=e("angular2/src/http/base_response_options"),u=e("angular2/src/core/di"),p=e("angular2/src/http/backends/browser_jsonp"),d=e("angular2/src/core/facade/async"),f=e("angular2/src/core/facade/exceptions"),h=e("angular2/src/core/facade/lang"),g=function(){function e(e,t,r){var n=this;if(this._dom=t,this.baseResponseOptions=r,this._finished=!1,e.method!==s.RequestMethods.Get)throw f.makeTypeError("JSONP requests must use GET request method.");this.request=e,this.response=new d.EventEmitter,this.readyState=s.ReadyStates.Loading,this._id=t.nextRequestID(),t.exposeConnection(this._id,this);var i=t.requestCallback(this._id),o=e.url;o.indexOf("=JSONP_CALLBACK&")>-1?o=h.StringWrapper.replace(o,"=JSONP_CALLBACK&","="+i+"&"):o.lastIndexOf("=JSONP_CALLBACK")===o.length-"=JSONP_CALLBACK".length&&(o=h.StringWrapper.substring(o,0,o.length-"=JSONP_CALLBACK".length)+("="+i));var a=this._script=t.build(o);a.addEventListener("load",function(e){if(n.readyState!==s.ReadyStates.Cancelled){if(n.readyState=s.ReadyStates.Done,t.cleanup(a),!n._finished)return void d.ObservableWrapper.callThrow(n.response,f.makeTypeError("JSONP injected script did not invoke callback."));var r=new l.ResponseOptions({body:n._responseData});h.isPresent(n.baseResponseOptions)&&(r=n.baseResponseOptions.merge(r)),d.ObservableWrapper.callNext(n.response,new c.Response(r))}}),a.addEventListener("error",function(e){n.readyState!==s.ReadyStates.Cancelled&&(n.readyState=s.ReadyStates.Done,t.cleanup(a),d.ObservableWrapper.callThrow(n.response,e))}),t.send(a)}return e.prototype.finished=function(e){this._finished=!0,this._dom.removeConnection(this._id),this.readyState!==s.ReadyStates.Cancelled&&(this._responseData=e)},e.prototype.dispose=function(){this.readyState=s.ReadyStates.Cancelled;var e=this._script;this._script=null,h.isPresent(e)&&this._dom.cleanup(e),d.ObservableWrapper.callReturn(this.response)},e}();t.JSONPConnection=g;var m=function(){function e(e,t){this._browserJSONP=e,this._baseResponseOptions=t}return e.prototype.createConnection=function(e){return new g(e,this._browserJSONP,this._baseResponseOptions)},e=o([u.Injectable(),a("design:paramtypes",[p.BrowserJsonp,l.ResponseOptions])],e)}();return t.JSONPBackend=m,n.define=i,r.exports}),System.register("angular2/src/core/di/binding",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/facade/collection","angular2/src/core/reflection/reflection","angular2/src/core/di/key","angular2/src/core/di/metadata","angular2/src/core/di/exceptions","angular2/src/core/di/forward_ref"],!0,function(e,t,r){function n(e){return new M(e)}function i(e){var t,r;if(y.isPresent(e.toClass)){var n=P.resolveForwardRef(e.toClass);t=w.reflector.factory(n),r=p(n)}else y.isPresent(e.toAlias)?(t=function(e){return e},r=[x.fromKey(C.Key.get(e.toAlias))]):y.isPresent(e.toFactory)?(t=e.toFactory,r=u(e.toFactory,e.dependencies)):(t=function(){return e.toValue},r=S);return new O(t,r)}function o(e){return new I(C.Key.get(e.token),[i(e)],!1)}function a(e){var t=s(c(e,new Map));return t.map(function(e){if(e instanceof A)return new I(e.key,[e.resolvedFactory],!1);var t=e;return new I(t[0].key,t.map(function(e){return e.resolvedFactory}),!0)})}function s(e){return b.MapWrapper.values(e)}function c(e,t){return b.ListWrapper.forEach(e,function(e){if(e instanceof y.Type)l(n(e).toClass(e),t);else if(e instanceof D)l(e,t);else{if(!(e instanceof Array))throw new E.InvalidBindingError(e instanceof M?e.token:e);c(e,t)}}),t}function l(e,t){var r=C.Key.get(e.token),n=i(e),o=new A(r,n);if(e.multi){var a=t.get(r.id);if(a instanceof Array)a.push(o);else{if(!y.isBlank(a))throw new E.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,[o])}}else{var a=t.get(r.id);if(a instanceof Array)throw new E.MixingMultiBindingsWithRegularBindings(a,e);t.set(r.id,o)}}function u(e,t){if(y.isBlank(t))return p(e);var r=b.ListWrapper.map(t,function(e){return[e]});return b.ListWrapper.map(t,function(t){return d(e,t,r)})}function p(e){var t=w.reflector.parameters(e);if(y.isBlank(t))return[];if(b.ListWrapper.any(t,function(e){return y.isBlank(e)}))throw new E.NoAnnotationError(e,t);return b.ListWrapper.map(t,function(r){return d(e,r,t)})}function d(e,t,r){var n=[],i=null,o=!1;if(!y.isArray(t))return f(t,o,null,null,n);for(var a=null,s=null,c=0;c=0;r--)d.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterContentChecked()},e.prototype.notifyAfterViewChecked=function(){for(var e=this.proto.elementBinders.length,t=this.elementInjectors,r=e-1;r>=0;r--)d.isPresent(t[r+this.elementOffset])&&t[r+this.elementOffset].afterViewChecked()},e.prototype.getDirectiveFor=function(e){var t=this.elementInjectors[this.elementOffset+e.elementIndex];return t.getDirectiveAtIndex(e.directiveIndex)},e.prototype.getNestedView=function(e){var t=this.mainMergeMapping.nestedViewIndicesByElementIndex[e];return d.isPresent(t)?this.views[t]:null},e.prototype.getHostElement=function(){var e=this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset];return d.isPresent(e)?this.elementRefs[e]:null},e.prototype.getDebugContext=function(e,t){try{var r=this.elementOffset+e,n=rE;E++){var P=e.mergeMapping.hostElementIndicesByViewIndex[E],x=u.isPresent(P)?d.internalView(g[P].parentView):null,S=u.isPresent(P)?x.proto.elementBinders[P-x.elementOffset].nestedProtoView:e,D=null;(0===E||S.type===m.ViewType.EMBEDDED)&&(D=i[R++]);var I=new p.AppView(n,S,e.mergeMapping,E,w,C,S.protoLocals,o,D);b[E]=I;for(var O=[],M=0;M=0;l--)u.isPresent(s.parent)&&o.rootElementInjectors[l].link(s.parent);s.traverseAndSetQueriesAsDirty()},e.prototype.detachViewInContainer=function(e,t,r){var n=e.viewContainers[t],i=n.views[r];e.elementInjectors[t].traverseAndSetQueriesAsDirty(),i.changeDetector.remove(),c.ListWrapper.removeAt(n.views,r);for(var o=0;o=o;){var s=e.views[o],c=s.proto;if(s!==e&&s.proto.type===m.ViewType.EMBEDDED)o+=e.mainMergeMapping.nestedViewCountByViewIndex[o]+1;else{if(s!==e){t=null,i=null;var l=e.mainMergeMapping.hostElementIndicesByViewIndex[o];r=e.elementInjectors[l],n=r.getComponent()}s.context=n,s.locals.parent=i;for(var p=c.elementBinders,d=0;d=r;r++){var n=e.views[r];if(n.hydrated()){u.isPresent(n.locals)&&n.locals.clearValues(),n.context=null,n.changeDetector.dehydrate();for(var i=n.proto.elementBinders,o=0;o=0){var n=t.substring(0,t.lastIndexOf("/"));i._substituteBaseUrl(d.DOM.content(r),n)}for(var o=d.DOM.querySelectorAll(d.DOM.content(r),"STYLE"),a=[],s=0;s=0&&d.DOM.setAttribute(e,n,c.StringWrapper.replaceAll(r,/\$baseUrl/g,t))})}for(var n=d.DOM.childNodes(e),i=0;i new "+n+"(dispatcher)"),r.toString()}return r=new c.ChangeDetectorJITGenerator(t,""+v+g,""+m+h),i.push("function(dispatcher) { return new "+r.typeName+"(dispatcher); }"),r.generateSource()});return new s.SourceExpressions(o,i)},e=o([f.Injectable(),a("design:paramtypes",[u.ChangeDetectorGenConfig])],e)}();return t.ChangeDetectionCompiler=_,n.define=i,r.exports}),System.register("angular2/src/compiler/template_parser",["angular2/src/core/facade/collection","angular2/src/core/facade/lang","angular2/src/core/di","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/change_detection","angular2/src/compiler/html_parser","angular2/src/compiler/template_ast","angular2/src/core/render/dom/compiler/selector","angular2/src/core/render/dom/schema/element_schema_registry","angular2/src/compiler/template_preparser","angular2/src/compiler/html_ast","angular2/src/compiler/util"],!0,function(e,t,r){function n(e){return u.StringWrapper.split(e.trim(),/\s+/g)}function i(e,t){var r=new m.CssSelector;r.setElement(e);for(var i=0;i0){var o=n.errors.join("\n");throw new d.BaseException("Template parse errors:\n"+o)}return i},e=s([p.Injectable(),c("design:paramtypes",[f.Parser,v.ElementSchemaRegistry,h.HtmlParser])],e)}();t.TemplateParser=M;var A=function(){function e(e,t,r){var n=this;this._exprParser=t,this._schemaRegistry=r,this.errors=[],this.directivesIndexByTypeId=new Map,this.selectorMatcher=new m.SelectorMatcher,l.ListWrapper.forEachWithIndex(e,function(e,t){var r=m.CssSelector.parse(e.selector);n.selectorMatcher.addSelectables(r,e),n.directivesIndexByTypeId.set(e.type.id,t)})}return e.prototype._reportError=function(e){this.errors.push(e)},e.prototype._parseInterpolation=function(e,t){try{return this._exprParser.parseInterpolation(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseAction=function(e,t){try{return this._exprParser.parseAction(e,t)}catch(r){return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseBinding=function(e,t){try{return this._exprParser.parseBinding(e,t)}catch(r){ +return this._reportError(""+r),this._exprParser.wrapLiteralPrimitive("ERROR",t)}},e.prototype._parseTemplateBindings=function(e,t){try{return this._exprParser.parseTemplateBindings(e,t)}catch(r){return this._reportError(""+r),[]}},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O),n=this._parseInterpolation(e.value,e.sourceInfo);return u.isPresent(n)?new g.BoundTextAst(n,r,e.sourceInfo):new g.TextAst(e.value,r,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitElement=function(e,t){var r=this,n=e.name,o=y.preparseElement(e);if(o.type===y.PreparsedElementType.SCRIPT||o.type===y.PreparsedElementType.STYLE||o.type===y.PreparsedElementType.STYLESHEET)return null;var a=[],s=[],c=[],u=[],p=[],d=[],f=[],h=!1,m=[];e.attrs.forEach(function(e){a.push([e.name,e.value]);var t=r._parseAttr(e,a,s,u,c),n=r._parseInlineTemplateBinding(e,f,p,d);t||n||m.push(r.visitAttr(e,null)),n&&(h=!0)});var v,b=n==C,w=i(n,a),R=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,w),s,b?[]:c,e.sourceInfo),E=this._createElementPropertyAsts(e.name,s,R),P=_.htmlVisitAll(o.nonBindable?V:this,e.children,B.create(R)),x=h?null:t.findNgContentIndex(w);if(o.type===y.PreparsedElementType.NG_CONTENT)v=new g.NgContentAst(x,e.sourceInfo);else if(b)this._assertNoComponentsNorElementBindingsOnTemplate(R,E,u,e.sourceInfo),v=new g.EmbeddedTemplateAst(m,c,R,P,x,e.sourceInfo);else{this._assertOnlyOneComponent(R,e.sourceInfo);var S=l.ListWrapper.filter(c,function(e){return 0===e.value.length});v=new g.ElementAst(n,m,E,u,S,R,P,x,e.sourceInfo)}if(h){var D=i(C,f),I=this._createDirectiveAsts(e.name,this._parseDirectives(this.selectorMatcher,D),p,[],e.sourceInfo),O=this._createElementPropertyAsts(e.name,p,I);this._assertNoComponentsNorElementBindingsOnTemplate(I,O,[],e.sourceInfo),v=new g.EmbeddedTemplateAst([],d,I,[v],t.findNgContentIndex(D),e.sourceInfo)}return v},e.prototype._parseInlineTemplateBinding=function(e,t,r,n){var i=null;if(e.name==R)i=e.value;else if(u.StringWrapper.startsWith(e.name,E)){var o=u.StringWrapper.substring(e.name,E.length);i=0==e.value.length?o:o+" "+e.value}if(u.isPresent(i)){for(var a=this._parseTemplateBindings(i,e.sourceInfo),s=0;s0&&!l.SetWrapper.has(a,e.name)&&o._reportError('There is no directive with "exportAs" set to "'+e.value+'" at '+e.sourceInfo)}),s},e.prototype._createDirectiveHostPropertyAsts=function(e,t,r,n){var i=this;u.isPresent(t)&&l.StringMapWrapper.forEach(t,function(t,o){var a=i._parseBinding(t,r);n.push(i._createElementPropertyAst(e,o,a,r))})},e.prototype._createDirectiveHostEventAsts=function(e,t,r){var n=this;u.isPresent(e)&&l.StringMapWrapper.forEach(e,function(e,i){n._parseEvent(i,e,t,[],r)})},e.prototype._createDirectivePropertyAsts=function(e,t,r){if(u.isPresent(e)){var n=new Map;t.forEach(function(e){var t=b.dashCaseToCamelCase(e.name),r=n.get(e.name);(u.isBlank(r)||r.isLiteral)&&n.set(t,e)}),l.StringMapWrapper.forEach(e,function(e,t){e=b.dashCaseToCamelCase(e);var i=n.get(e);u.isPresent(i)&&r.push(new g.BoundDirectivePropertyAst(t,i.name,i.expression,i.sourceInfo))})}},e.prototype._createElementPropertyAsts=function(e,t,r){var n=this,i=[],o=new Map;return r.forEach(function(e){e.properties.forEach(function(e){o.set(e.templateName,e)})}),t.forEach(function(t){!t.isLiteral&&u.isBlank(o.get(t.name))&&i.push(n._createElementPropertyAst(e,t.name,t.expression,t.sourceInfo))}),i},e.prototype._createElementPropertyAst=function(e,t,r,n){var i,o,a=null,s=u.StringWrapper.split(t,x);return 1===s.length?(o=this._schemaRegistry.getMappedPropName(b.dashCaseToCamelCase(s[0])),i=g.PropertyBindingType.Property,this._schemaRegistry.hasProperty(e,o)||this._reportError("Can't bind to '"+o+"' since it isn't a known native property in "+n)):s[0]==S?(o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Attribute):s[0]==D?(o=s[1],i=g.PropertyBindingType.Class):s[0]==I?(a=s.length>2?s[2]:null,o=b.dashCaseToCamelCase(s[1]),i=g.PropertyBindingType.Style):(this._reportError("Invalid property name "+t+" in "+n),i=null),new g.BoundElementPropertyAst(o,i,r,a,n)},e.prototype._findComponentDirectiveNames=function(e){var t=[];return e.forEach(function(e){var r=e.directive.type.name;e.directive.isComponent&&t.push(r)}),t},e.prototype._assertOnlyOneComponent=function(e,t){var r=this._findComponentDirectiveNames(e);r.length>1&&this._reportError("More than one component: "+r.join(",")+" in "+t)},e.prototype._assertNoComponentsNorElementBindingsOnTemplate=function(e,t,r,n){var i=this,o=this._findComponentDirectiveNames(e);o.length>0&&this._reportError("Components on an embedded template: "+o.join(",")+" in "+n),t.forEach(function(e){i._reportError("Property binding "+e.name+" not used by any directive on an embedded template in "+e.sourceInfo)}),r.forEach(function(e){i._reportError("Event binding "+e.name+" on an embedded template in "+e.sourceInfo)})},e}(),T=function(){function e(){}return e.prototype.visitElement=function(e,t){var r=y.preparseElement(e);if(r.type===y.PreparsedElementType.SCRIPT||r.type===y.PreparsedElementType.STYLE||r.type===y.PreparsedElementType.STYLESHEET)return null;var n=e.attrs.map(function(e){return[e.name,e.value]}),o=i(e.name,n),a=t.findNgContentIndex(o),s=_.htmlVisitAll(this,e.children,k);return new g.ElementAst(e.name,_.htmlVisitAll(this,e.attrs),[],[],[],[],s,a,e.sourceInfo)},e.prototype.visitAttr=function(e,t){return new g.AttrAst(e.name,e.value,e.sourceInfo)},e.prototype.visitText=function(e,t){var r=t.findNgContentIndex(O);return new g.TextAst(e.value,r,e.sourceInfo)},e}(),N=function(){function e(e,t,r,n){this.name=e,this.expression=t,this.isLiteral=r,this.sourceInfo=n}return e}();!function(){function e(e,t){this.message=e,this.sourceInfo=t}return e}(),t.splitClasses=n;var B=function(){function e(e,t){this.ngContentIndexMatcher=e,this.wildcardNgContentIndex=t}return e.create=function(t){if(0===t.length||!t[0].directive.isComponent)return k;for(var r=new m.SelectorMatcher,n=t[0].directive.template.ngContentSelectors,i=null,o=0;o0?t[0]:null},e}(),k=new B(new m.SelectorMatcher,null),V=new T;return o.define=a,r.exports}),System.register("angular2/src/http/http",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/di/decorators","angular2/src/http/interfaces","angular2/src/http/static_request","angular2/src/http/base_request_options","angular2/src/http/enums"],!0,function(e,t,r){function n(e,t){return e.createConnection(t).response}function i(e,t,r,n){var i=e;return u.isPresent(t)&&(i=i.merge(new g.RequestOptions({method:t.method,url:t.url,search:t.search,headers:t.headers,body:t.body,mode:t.mode,credentials:t.credentials,cache:t.cache}))),i.merge(new g.RequestOptions(u.isPresent(r)?{method:r,url:n}:{url:n}))}var o=System.global,a=o.define;o.define=void 0;var s=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},c=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},l=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},u=e("angular2/src/core/facade/lang"),p=e("angular2/src/core/facade/exceptions"),d=e("angular2/src/core/di/decorators"),f=e("angular2/src/http/interfaces"),h=e("angular2/src/http/static_request"),g=e("angular2/src/http/base_request_options"),m=e("angular2/src/http/enums"),v=function(){function e(e,t){this._backend=e,this._defaultOptions=t}return e.prototype.request=function(e,t){var r;if(u.isString(e))r=n(this._backend,new h.Request(i(this._defaultOptions,t,m.RequestMethods.Get,e)));else{if(!(e instanceof h.Request))throw p.makeTypeError("First argument must be a url string or Request instance.");r=n(this._backend,e)}return r},e.prototype.get=function(e,t){return n(this._backend,new h.Request(i(this._defaultOptions,t,m.RequestMethods.Get,e)))},e.prototype.post=function(e,t,r){return n(this._backend,new h.Request(i(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,m.RequestMethods.Post,e)))},e.prototype.put=function(e,t,r){return n(this._backend,new h.Request(i(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,m.RequestMethods.Put,e)))},e.prototype["delete"]=function(e,t){return n(this._backend,new h.Request(i(this._defaultOptions,t,m.RequestMethods.Delete,e)))},e.prototype.patch=function(e,t,r){return n(this._backend,new h.Request(i(this._defaultOptions.merge(new g.RequestOptions({body:t})),r,m.RequestMethods.Patch,e)))},e.prototype.head=function(e,t){return n(this._backend,new h.Request(i(this._defaultOptions,t,m.RequestMethods.Head,e)))},e=c([d.Injectable(),l("design:paramtypes",[f.ConnectionBackend,g.RequestOptions])],e)}();t.Http=v;var y=function(e){function t(t,r){e.call(this,t,r)}return s(t,e),t.prototype.request=function(e,t){var r;if(u.isString(e)&&(e=new h.Request(i(this._defaultOptions,t,m.RequestMethods.Get,e))),!(e instanceof h.Request))throw p.makeTypeError("First argument must be a url string or Request instance.");return e.method!==m.RequestMethods.Get&&p.makeTypeError("JSONP requests must use GET request method."),r=n(this._backend,e)},t=c([d.Injectable(),l("design:paramtypes",[f.ConnectionBackend,g.RequestOptions])],t)}(v);return t.Jsonp=y,o.define=a,r.exports}),System.register("angular2/src/http/backends/xhr_backend",["angular2/src/http/enums","angular2/src/http/static_response","angular2/src/http/base_response_options","angular2/src/core/di","angular2/src/http/backends/browser_xhr","angular2/src/core/facade/async","angular2/src/core/facade/lang"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},a=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},s=e("angular2/src/http/enums"),c=e("angular2/src/http/static_response"),l=e("angular2/src/http/base_response_options"),u=e("angular2/src/core/di"),p=e("angular2/src/http/backends/browser_xhr"),d=e("angular2/src/core/facade/async"),f=e("angular2/src/core/facade/lang"),h=function(){function e(e,t,r){var n=this;this.request=e,this.response=new d.EventEmitter,this._xhr=t.build(),this._xhr.open(s.RequestMethods[e.method].toUpperCase(),e.url),this._xhr.addEventListener("load",function(e){var t=f.isPresent(n._xhr.response)?n._xhr.response:n._xhr.responseText,i=1223===n._xhr.status?204:n._xhr.status;0===i&&(i=t?200:0);var o=new l.ResponseOptions({body:t,status:i});f.isPresent(r)&&(o=r.merge(o)),d.ObservableWrapper.callNext(n.response,new c.Response(o)),d.ObservableWrapper.callReturn(n.response)}),this._xhr.addEventListener("error",function(e){var t=new l.ResponseOptions({body:e,type:s.ResponseTypes.Error});f.isPresent(r)&&(t=r.merge(t)),d.ObservableWrapper.callThrow(n.response,new c.Response(t))}),f.isPresent(e.headers)&&e.headers.forEach(function(e,t){n._xhr.setRequestHeader(t,e)}),this._xhr.send(this.request.text())}return e.prototype.dispose=function(){this._xhr.abort()},e}();t.XHRConnection=h;var g=function(){function e(e,t){this._browserXHR=e,this._baseResponseOptions=t}return e.prototype.createConnection=function(e){return new h(e,this._browserXHR,this._baseResponseOptions)},e=o([u.Injectable(),a("design:paramtypes",[p.BrowserXhr,l.ResponseOptions])],e)}();return t.XHRBackend=g,n.define=i,r.exports}),System.register("angular2/src/core/di/injector",["angular2/src/core/facade/collection","angular2/src/core/di/binding","angular2/src/core/di/exceptions","angular2/src/core/facade/lang","angular2/src/core/di/key","angular2/src/core/di/metadata"],!0,function(e,t,r){function n(e,t){return e===t||t===h.PublicAndPrivate||e===h.PublicAndPrivate}function i(e,t){for(var r=[],n=0;n0&&(this.binding0=t[0].binding,this.keyId0=t[0].getKeyId(),this.visibility0=t[0].visibility),r>1&&(this.binding1=t[1].binding,this.keyId1=t[1].getKeyId(),this.visibility1=t[1].visibility),r>2&&(this.binding2=t[2].binding,this.keyId2=t[2].getKeyId(),this.visibility2=t[2].visibility),r>3&&(this.binding3=t[3].binding,this.keyId3=t[3].getKeyId(),this.visibility3=t[3].visibility),r>4&&(this.binding4=t[4].binding,this.keyId4=t[4].getKeyId(),this.visibility4=t[4].visibility),r>5&&(this.binding5=t[5].binding,this.keyId5=t[5].getKeyId(),this.visibility5=t[5].visibility),r>6&&(this.binding6=t[6].binding,this.keyId6=t[6].getKeyId(),this.visibility6=t[6].visibility),r>7&&(this.binding7=t[7].binding,this.keyId7=t[7].getKeyId(),this.visibility7=t[7].visibility),r>8&&(this.binding8=t[8].binding,this.keyId8=t[8].getKeyId(),this.visibility8=t[8].visibility),r>9&&(this.binding9=t[9].binding,this.keyId9=t[9].getKeyId(),this.visibility9=t[9].visibility)}return e.prototype.getBindingAtIndex=function(e){if(0==e)return this.binding0;if(1==e)return this.binding1;if(2==e)return this.binding2;if(3==e)return this.binding3;if(4==e)return this.binding4;if(5==e)return this.binding5;if(6==e)return this.binding6;if(7==e)return this.binding7;if(8==e)return this.binding8;if(9==e)return this.binding9;throw new l.OutOfBoundsError(e)},e.prototype.createInjectorStrategy=function(e){return new y(e,this)},e}();t.ProtoInjectorInlineStrategy=g;var m=function(){function e(e,t){var r=t.length;this.bindings=s.ListWrapper.createFixedSize(r),this.keyIds=s.ListWrapper.createFixedSize(r),this.visibilities=s.ListWrapper.createFixedSize(r);for(var n=0;r>n;n++)this.bindings[n]=t[n].binding,this.keyIds[n]=t[n].getKeyId(),this.visibilities[n]=t[n].visibility}return e.prototype.getBindingAtIndex=function(e){if(0>e||e>=this.bindings.length)throw new l.OutOfBoundsError(e);return this.bindings[e]},e.prototype.createInjectorStrategy=function(e){return new _(this,e)},e}();t.ProtoInjectorDynamicStrategy=m;var v=function(){function e(e){this.numberOfBindings=e.length,this._strategy=e.length>f?new m(this,e):new g(this,e)}return e.prototype.getBindingAtIndex=function(e){return this._strategy.getBindingAtIndex(e)},e}();t.ProtoInjector=v;var y=function(){function e(e,r){this.injector=e,this.protoStrategy=r,this.obj0=t.UNDEFINED,this.obj1=t.UNDEFINED,this.obj2=t.UNDEFINED,this.obj3=t.UNDEFINED,this.obj4=t.UNDEFINED,this.obj5=t.UNDEFINED,this.obj6=t.UNDEFINED,this.obj7=t.UNDEFINED,this.obj8=t.UNDEFINED,this.obj9=t.UNDEFINED}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){var i=this.protoStrategy,o=this.injector;return i.keyId0===e&&n(i.visibility0,r)?(this.obj0===t.UNDEFINED&&(this.obj0=o._new(i.binding0,i.visibility0)),this.obj0):i.keyId1===e&&n(i.visibility1,r)?(this.obj1===t.UNDEFINED&&(this.obj1=o._new(i.binding1,i.visibility1)),this.obj1):i.keyId2===e&&n(i.visibility2,r)?(this.obj2===t.UNDEFINED&&(this.obj2=o._new(i.binding2,i.visibility2)),this.obj2):i.keyId3===e&&n(i.visibility3,r)?(this.obj3===t.UNDEFINED&&(this.obj3=o._new(i.binding3,i.visibility3)),this.obj3):i.keyId4===e&&n(i.visibility4,r)?(this.obj4===t.UNDEFINED&&(this.obj4=o._new(i.binding4,i.visibility4)),this.obj4):i.keyId5===e&&n(i.visibility5,r)?(this.obj5===t.UNDEFINED&&(this.obj5=o._new(i.binding5,i.visibility5)),this.obj5):i.keyId6===e&&n(i.visibility6,r)?(this.obj6===t.UNDEFINED&&(this.obj6=o._new(i.binding6,i.visibility6)),this.obj6):i.keyId7===e&&n(i.visibility7,r)?(this.obj7===t.UNDEFINED&&(this.obj7=o._new(i.binding7,i.visibility7)),this.obj7):i.keyId8===e&&n(i.visibility8,r)?(this.obj8===t.UNDEFINED&&(this.obj8=o._new(i.binding8,i.visibility8)),this.obj8):i.keyId9===e&&n(i.visibility9,r)?(this.obj9===t.UNDEFINED&&(this.obj9=o._new(i.binding9,i.visibility9)),this.obj9):t.UNDEFINED},e.prototype.getObjAtIndex=function(e){if(0==e)return this.obj0;if(1==e)return this.obj1;if(2==e)return this.obj2;if(3==e)return this.obj3;if(4==e)return this.obj4;if(5==e)return this.obj5;if(6==e)return this.obj6;if(7==e)return this.obj7;if(8==e)return this.obj8;if(9==e)return this.obj9;throw new l.OutOfBoundsError(e)},e.prototype.getMaxNumberOfObjects=function(){return f},e}();t.InjectorInlineStrategy=y;var _=function(){function e(e,r){this.protoStrategy=e,this.injector=r,this.objs=s.ListWrapper.createFixedSize(e.bindings.length),s.ListWrapper.fill(this.objs,t.UNDEFINED)}return e.prototype.resetConstructionCounter=function(){this.injector._constructionCounter=0},e.prototype.instantiateBinding=function(e,t){return this.injector._new(e,t)},e.prototype.attach=function(e,t){var r=this.injector;r._parent=e,r._isHost=t},e.prototype.getObjByKeyId=function(e,r){for(var i=this.protoStrategy,o=0;oe||e>=this.objs.length)throw new l.OutOfBoundsError(e);return this.objs[e]},e.prototype.getMaxNumberOfObjects=function(){return this.objs.length},e}();t.InjectorDynamicStrategy=_;var b=function(){function e(e,t){this.binding=e,this.visibility=t}return e.prototype.getKeyId=function(){return this.binding.key.id},e}();t.BindingWithVisibility=b;var w=function(){function e(e,t,r,n){void 0===t&&(t=null),void 0===r&&(r=null),void 0===n&&(n=null),this._proto=e,this._parent=t,this._depProvider=r,this._debugContext=n,this._isHost=!1,this._constructionCounter=0,this._strategy=e._strategy.createInjectorStrategy(this)}return e.resolve=function(e){return c.resolveBindings(e)},e.resolveAndCreate=function(t){var r=e.resolve(t);return e.fromResolvedBindings(r)},e.fromResolvedBindings=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new v(r);return new e(n,null,null)},e.prototype.debugContext=function(){return this._debugContext()},e.prototype.get=function(e){return this._getByKey(p.Key.get(e),null,null,!1,h.PublicAndPrivate)},e.prototype.getOptional=function(e){return this._getByKey(p.Key.get(e),null,null,!0,h.PublicAndPrivate)},e.prototype.getAt=function(e){return this._strategy.getObjAtIndex(e)},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"internalStrategy",{get:function(){return this._strategy},enumerable:!0,configurable:!0}),e.prototype.resolveAndCreateChild=function(t){var r=e.resolve(t);return this.createChildFromResolved(r)},e.prototype.createChildFromResolved=function(t){var r=t.map(function(e){return new b(e,h.Public)}),n=new v(r),i=new e(n,null,null);return i._parent=this,i},e.prototype.resolveAndInstantiate=function(t){return this.instantiateResolved(e.resolve([t])[0])},e.prototype.instantiateResolved=function(e){return this._instantiateBinding(e,h.PublicAndPrivate)},e.prototype._new=function(e,t){if(this._constructionCounter++>this._strategy.getMaxNumberOfObjects())throw new l.CyclicDependencyError(this,e.key);return this._instantiateBinding(e,t)},e.prototype._instantiateBinding=function(e,t){if(e.multiBinding){for(var r=s.ListWrapper.createFixedSize(e.resolvedFactories.length),n=0;n0?this._getByDependency(e,P[0],r):null,i=x>1?this._getByDependency(e,P[1],r):null,o=x>2?this._getByDependency(e,P[2],r):null,a=x>3?this._getByDependency(e,P[3],r):null,s=x>4?this._getByDependency(e,P[4],r):null,c=x>5?this._getByDependency(e,P[5],r):null,u=x>6?this._getByDependency(e,P[6],r):null,p=x>7?this._getByDependency(e,P[7],r):null,d=x>8?this._getByDependency(e,P[8],r):null,f=x>9?this._getByDependency(e,P[9],r):null,h=x>10?this._getByDependency(e,P[10],r):null,g=x>11?this._getByDependency(e,P[11],r):null,m=x>12?this._getByDependency(e,P[12],r):null,v=x>13?this._getByDependency(e,P[13],r):null,y=x>14?this._getByDependency(e,P[14],r):null,_=x>15?this._getByDependency(e,P[15],r):null,b=x>16?this._getByDependency(e,P[16],r):null,w=x>17?this._getByDependency(e,P[17],r):null,C=x>18?this._getByDependency(e,P[18],r):null,R=x>19?this._getByDependency(e,P[19],r):null}catch(S){throw(S instanceof l.AbstractBindingError||S instanceof l.InstantiationError)&&S.addKey(this,e.key),S}var D;try{switch(x){case 0:D=E();break;case 1:D=E(n);break;case 2:D=E(n,i);break;case 3:D=E(n,i,o);break;case 4:D=E(n,i,o,a);break;case 5:D=E(n,i,o,a,s);break;case 6:D=E(n,i,o,a,s,c);break;case 7:D=E(n,i,o,a,s,c,u);break;case 8:D=E(n,i,o,a,s,c,u,p);break;case 9:D=E(n,i,o,a,s,c,u,p,d);break;case 10:D=E(n,i,o,a,s,c,u,p,d,f);break;case 11:D=E(n,i,o,a,s,c,u,p,d,f,h);break;case 12:D=E(n,i,o,a,s,c,u,p,d,f,h,g);break;case 13:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m);break;case 14:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v);break;case 15:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y);break;case 16:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_);break;case 17:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b);break;case 18:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w);break;case 19:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w,C);break;case 20:D=E(n,i,o,a,s,c,u,p,d,f,h,g,m,v,y,_,b,w,C,R)}}catch(S){throw new l.InstantiationError(this,S,S.stack,e.key)}return D},e.prototype._getByDependency=function(e,r,n){var i=u.isPresent(this._depProvider)?this._depProvider.getDependency(this,e,r):t.UNDEFINED;return i!==t.UNDEFINED?i:this._getByKey(r.key,r.lowerBoundVisibility,r.upperBoundVisibility,r.optional,n)},e.prototype._getByKey=function(e,t,r,n,i){return e===C?this:r instanceof d.SelfMetadata?this._getByKeySelf(e,n,i):r instanceof d.HostMetadata?this._getByKeyHost(e,n,i,t):this._getByKeyDefault(e,n,i,t)},e.prototype._throwOrNull=function(e,t){if(t)return null;throw new l.NoBindingError(this,e)},e.prototype._getByKeySelf=function(e,r,n){var i=this._strategy.getObjByKeyId(e.id,n);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyHost=function(e,r,n,i){var o=this;if(i instanceof d.SkipSelfMetadata){if(o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}for(;null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;if(u.isPresent(o._parent)&&o._isHost)return this._getPrivateDependency(e,r,o);o=o._parent}return this._throwOrNull(e,r)},e.prototype._getPrivateDependency=function(e,r,n){var i=n._parent._strategy.getObjByKeyId(e.id,h.Private);return i!==t.UNDEFINED?i:this._throwOrNull(e,r)},e.prototype._getByKeyDefault=function(e,r,n,i){var o=this;for(i instanceof d.SkipSelfMetadata&&(n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent);null!=o;){var a=o._strategy.getObjByKeyId(e.id,n);if(a!==t.UNDEFINED)return a;n=o._isHost?h.PublicAndPrivate:h.Public,o=o._parent}return this._throwOrNull(e,r)},Object.defineProperty(e.prototype,"displayName",{get:function(){return"Injector(bindings: ["+i(this,function(e){return' "'+e.key.displayName+'" '}).join(", ")+"])"},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.displayName},e}();t.Injector=w;var C=p.Key.get(w);return o.define=a,r.exports}),System.register("angular2/src/core/change_detection/change_detection_jit_generator",["angular2/src/core/facade/lang","angular2/src/core/facade/exceptions","angular2/src/core/change_detection/abstract_change_detector","angular2/src/core/change_detection/change_detection_util","angular2/src/core/change_detection/codegen_name_util","angular2/src/core/change_detection/codegen_logic_util","angular2/src/core/change_detection/codegen_facade","angular2/src/core/change_detection/proto_change_detector"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=e("angular2/src/core/facade/lang"),a=e("angular2/src/core/facade/exceptions"),s=e("angular2/src/core/change_detection/abstract_change_detector"),c=e("angular2/src/core/change_detection/change_detection_util"),l=e("angular2/src/core/change_detection/codegen_name_util"),u=e("angular2/src/core/change_detection/codegen_logic_util"),p=e("angular2/src/core/change_detection/codegen_facade"),d=e("angular2/src/core/change_detection/proto_change_detector"),f="isChanged",h="changes",g=function(){function e(e,t,r){this.changeDetectionUtilVarName=t,this.abstractChangeDetectorVarName=r;var n=d.createPropertyRecords(e),i=d.createEventRecords(e),o=e.bindingRecords.map(function(e){return e.target});this.id=e.id,this.changeDetectionStrategy=e.strategy,this.genConfig=e.genConfig,this.records=n,this.propertyBindingTargets=o,this.eventBindings=i,this.directiveRecords=e.directiveRecords,this._names=new l.CodegenNameUtil(this.records,this.eventBindings,this.directiveRecords,this.changeDetectionUtilVarName),this._logic=new u.CodegenLogicUtil(this._names,this.changeDetectionUtilVarName,this.changeDetectionStrategy),this.typeName=l.sanitizeName("ChangeDetector_"+this.id)}return e.prototype.generate=function(){var e="\n "+this.generateSource()+"\n return function(dispatcher) {\n return new "+this.typeName+"(dispatcher);\n }\n ";return new Function(this.abstractChangeDetectorVarName,this.changeDetectionUtilVarName,e)(s.AbstractChangeDetector,c.ChangeDetectionUtil)},e.prototype.generateSource=function(){var e=this;return"\n var "+this.typeName+" = function "+this.typeName+"(dispatcher) {\n "+this.abstractChangeDetectorVarName+".call(\n this, "+JSON.stringify(this.id)+", dispatcher, "+this.records.length+",\n "+this.typeName+".gen_propertyBindingTargets, "+this.typeName+".gen_directiveIndices,\n "+p.codify(this.changeDetectionStrategy)+");\n this.dehydrateDirectives(false);\n }\n\n "+this.typeName+".prototype = Object.create("+this.abstractChangeDetectorVarName+".prototype);\n\n "+this.typeName+".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n "+this._names.genInitLocals()+"\n var "+f+" = false;\n var "+h+" = null;\n\n "+this.records.map(function(t){return e._genRecord(t)}).join("\n")+"\n }\n\n "+this._maybeGenHandleEventInternal()+"\n\n "+this._genCheckNoChanges()+"\n\n "+this._maybeGenAfterContentLifecycleCallbacks()+"\n\n "+this._maybeGenAfterViewLifecycleCallbacks()+"\n\n "+this._maybeGenHydrateDirectives()+"\n\n "+this._maybeGenDehydrateDirectives()+"\n\n "+this._genPropertyBindingTargets()+"\n\n "+this._genDirectiveIndices()+"\n "},e.prototype._genPropertyBindingTargets=function(){var e=this._logic.genPropertyBindingTargets(this.propertyBindingTargets,this.genConfig.genDebugInfo);return this.typeName+".gen_propertyBindingTargets = "+e+";"},e.prototype._genDirectiveIndices=function(){var e=this._logic.genDirectiveIndices(this.directiveRecords);return this.typeName+".gen_directiveIndices = "+e+";"},e.prototype._maybeGenHandleEventInternal=function(){var e=this;if(this.eventBindings.length>0){var t=this.eventBindings.map(function(t){ +return e._genEventBinding(t)}).join("\n");return"\n "+this.typeName+".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var "+this._names.getPreventDefaultAccesor()+" = false;\n "+this._names.genInitEventLocals()+"\n "+t+"\n return "+this._names.getPreventDefaultAccesor()+";\n }\n "}return""},e.prototype._genEventBinding=function(e){var t=this,r=e.records.map(function(r){return t._genEventBindingEval(e,r)}).join("\n");return'\n if (eventName === "'+e.eventName+'" && elIndex === '+e.elIndex+") {\n "+r+"\n }"},e.prototype._genEventBindingEval=function(e,t){if(t.lastInBinding){var r=this._logic.genEventBindingEvalValue(e,t),n=this._genMarkPathToRootAsCheckOnce(t),i=this._genUpdatePreventDefault(e,t);return r+"\n"+n+"\n"+i}return this._logic.genEventBindingEvalValue(e,t)},e.prototype._genMarkPathToRootAsCheckOnce=function(e){var t=e.bindingRecord;return t.isDefaultChangeDetection()?"":this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markPathToRootAsCheckOnce();"},e.prototype._genUpdatePreventDefault=function(e,t){var r=this._names.getEventLocalName(e,t.selfIndex);return"if ("+r+" === false) { "+this._names.getPreventDefaultAccesor()+" = true};"},e.prototype._maybeGenDehydrateDirectives=function(){var e=this._names.genPipeOnDestroy();e&&(e="if (destroyPipes) { "+e+" }");var t=this._names.genDehydrateFields();return e||t?this.typeName+".prototype.dehydrateDirectives = function(destroyPipes) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenHydrateDirectives=function(){var e=this._logic.genHydrateDirectives(this.directiveRecords),t=this._logic.genHydrateDetectors(this.directiveRecords);return e||t?this.typeName+".prototype.hydrateDirectives = function(directives) {\n "+e+"\n "+t+"\n }":""},e.prototype._maybeGenAfterContentLifecycleCallbacks=function(){var e=this._logic.genContentLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterContentLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._maybeGenAfterViewLifecycleCallbacks=function(){var e=this._logic.genViewLifecycleCallbacks(this.directiveRecords);if(e.length>0){var t=e.join("\n");return"\n "+this.typeName+".prototype.afterViewLifecycleCallbacksInternal = function() {\n "+t+"\n }\n "}return""},e.prototype._genRecord=function(e){var t;return t=e.isLifeCycleRecord()?this._genDirectiveLifecycle(e):e.isPipeRecord()?this._genPipeCheck(e):this._genReferenceCheck(e),"\n "+this._maybeFirstInBinding(e)+"\n "+t+"\n "+this._maybeGenLastInDirective(e)+"\n "},e.prototype._genDirectiveLifecycle=function(e){if("DoCheck"===e.name)return this._genOnCheck(e);if("OnInit"===e.name)return this._genOnInit(e);if("OnChanges"===e.name)return this._genOnChange(e);throw new a.BaseException("Unknown lifecycle event '"+e.name+"'")},e.prototype._genPipeCheck=function(e){var t=this,r=this._names.getLocalName(e.contextIndex),n=e.args.map(function(e){return t._names.getLocalName(e)}).join(", "),i=this._names.getFieldName(e.selfIndex),o=this._names.getLocalName(e.selfIndex),a=this._names.getPipeName(e.selfIndex),s=e.name,c="\n if ("+a+" === "+this.changeDetectionUtilVarName+".uninitialized) {\n "+a+" = "+this._names.getPipesAccessorName()+".get('"+s+"');\n }\n ",l=o+" = "+a+".pipe.transform("+r+", ["+n+"]);",u=e.args.map(function(e){return t._names.getChangeName(e)});u.push(this._names.getChangeName(e.contextIndex));var p="!"+a+".pure || ("+u.join(" || ")+")",d="\n if ("+i+" !== "+o+") {\n "+o+" = "+this.changeDetectionUtilVarName+".unwrapValue("+o+")\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+i+" = "+o+";\n }\n ",f=e.shouldBeChecked()?""+l+d:l;return e.isUsedByOtherRecord()?c+" if ("+p+") { "+f+" } else { "+o+" = "+i+"; }":c+" if ("+p+") { "+f+" }"},e.prototype._genReferenceCheck=function(e){var t=this,r=this._names.getFieldName(e.selfIndex),n=this._names.getLocalName(e.selfIndex),i="\n "+this._logic.genPropertyBindingEvalValue(e)+"\n ",o="\n if ("+n+" !== "+r+") {\n "+this._genChangeMarker(e)+"\n "+this._genUpdateDirectiveOrElement(e)+"\n "+this._genAddToChanges(e)+"\n "+r+" = "+n+";\n }\n ",a=e.shouldBeChecked()?""+i+o:i;if(e.isPureFunction()){var s=e.args.map(function(e){return t._names.getChangeName(e)}).join(" || ");return e.isUsedByOtherRecord()?"if ("+s+") { "+a+" } else { "+n+" = "+r+"; }":"if ("+s+") { "+a+" }"}return a},e.prototype._genChangeMarker=function(e){return e.argumentToPureFunction?this._names.getChangeName(e.selfIndex)+" = true":""},e.prototype._genUpdateDirectiveOrElement=function(e){if(!e.lastInBinding)return"";var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex),n=this.genConfig.logBindingUpdate?"this.logBindingUpdate("+t+");":"",i=e.bindingRecord;if(i.target.isDirective()){var o=this._names.getDirectiveName(i.directiveRecord.directiveIndex)+"."+i.target.name;return"\n "+this._genThrowOnChangeCheck(r,t)+"\n "+o+" = "+t+";\n "+n+"\n "+f+" = true;\n "}return"\n "+this._genThrowOnChangeCheck(r,t)+"\n this.notifyDispatcher("+t+");\n "+n+"\n "},e.prototype._genThrowOnChangeCheck=function(e,t){return this.genConfig.genCheckNoChanges?"\n if(throwOnChange) {\n this.throwOnChangeError("+e+", "+t+");\n }\n ":""},e.prototype._genCheckNoChanges=function(){return this.genConfig.genCheckNoChanges?this.typeName+".prototype.checkNoChanges = function() { this.runDetectChanges(true); }":""},e.prototype._genAddToChanges=function(e){var t=this._names.getLocalName(e.selfIndex),r=this._names.getFieldName(e.selfIndex);return e.bindingRecord.callOnChanges()?h+" = this.addChange("+h+", "+r+", "+t+");":""},e.prototype._maybeFirstInBinding=function(e){var t=c.ChangeDetectionUtil.protoByIndex(this.records,e.selfIndex-1),r=o.isBlank(t)||t.bindingRecord!==e.bindingRecord;return r&&!e.bindingRecord.isDirectiveLifecycle()?this._names.getPropertyBindingIndex()+" = "+e.propertyBindingIndex+";":""},e.prototype._maybeGenLastInDirective=function(e){return e.lastInDirective?"\n "+h+" = null;\n "+this._genNotifyOnPushDetectors(e)+"\n "+f+" = false;\n ":""},e.prototype._genOnCheck=function(e){var t=e.bindingRecord;return"if (!throwOnChange) "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".doCheck();"},e.prototype._genOnInit=function(e){var t=e.bindingRecord;return"if (!throwOnChange && !"+this._names.getAlreadyCheckedName()+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onInit();"},e.prototype._genOnChange=function(e){var t=e.bindingRecord;return"if (!throwOnChange && "+h+") "+this._names.getDirectiveName(t.directiveRecord.directiveIndex)+".onChanges("+h+");"},e.prototype._genNotifyOnPushDetectors=function(e){var t=e.bindingRecord;if(!e.lastInDirective||t.isDefaultChangeDetection())return"";var r="\n if("+f+") {\n "+this._names.getDetectorName(t.directiveRecord.directiveIndex)+".markAsCheckOnce();\n }\n ";return r},e}();return t.ChangeDetectorJITGenerator=g,n.define=i,r.exports}),System.register("@reactivex/rxjs/dist/cjs/Subject",["@reactivex/rxjs/dist/cjs/Observable","@reactivex/rxjs/dist/cjs/Subscriber","@reactivex/rxjs/dist/cjs/Subscription","@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"],!0,function(e,t,r){function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=System.global,s=a.define;a.define=void 0,t.__esModule=!0;var c=e("@reactivex/rxjs/dist/cjs/Observable"),l=n(c),u=e("@reactivex/rxjs/dist/cjs/Subscriber"),p=n(u),d=e("@reactivex/rxjs/dist/cjs/Subscription"),f=n(d),h=e("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"),g=n(h),m=f["default"].prototype.add,v=f["default"].prototype.remove,y=f["default"].prototype.unsubscribe,_=p["default"].prototype.next,b=p["default"].prototype.error,w=p["default"].prototype.complete,C=p["default"].prototype._next,R=p["default"].prototype._error,E=p["default"].prototype._complete,P=l["default"].prototype._subscribe,x=function(e){function t(){i(this,t);for(var r=arguments.length,n=Array(r),o=0;r>o;o++)n[o]=arguments[o];e.call.apply(e,[this].concat(n)),this.observers=[],this.isUnsubscribed=!1,this.dispatching=!1,this.errorSignal=!1,this.completeSignal=!1}return o(t,e),t.create=function(e,t){return new S(e,t)},t.prototype.lift=function(e){var t=new S(this,this.destination||this);return t.operator=e,t},t.prototype._subscribe=function(e){if(!e.isUnsubscribed){if(this.errorSignal)return void e.error(this.errorInstance);if(this.completeSignal)return void e.complete();if(this.isUnsubscribed)throw new Error("Cannot subscribe to a disposed Subject.");return this.observers.push(e),new g["default"](this,e)}},t.prototype.add=function(e){m.call(this,e)},t.prototype.remove=function(e){v.call(this,e)},t.prototype.unsubscribe=function(){this.observers=void 0,y.call(this)},t.prototype.next=function(e){this.isUnsubscribed||(this.dispatching=!0,this._next(e),this.dispatching=!1,this.errorSignal?this.error(this.errorInstance):this.completeSignal&&this.complete())},t.prototype.error=function(e){this.isUnsubscribed||this.completeSignal||(this.errorSignal=!0,this.errorInstance=e,this.dispatching||(this._error(e),this.unsubscribe()))},t.prototype.complete=function(){this.isUnsubscribed||this.errorSignal||(this.completeSignal=!0,this.dispatching||(this._complete(),this.unsubscribe()))},t.prototype._next=function(e){for(var t=-1,r=this.observers.slice(0),n=r.length;++t0?this._renderer.detachFragment(i.renderFragment):(this._renderer.dehydrateView(i.render),this._renderer.detachFragment(i.renderFragment),this._destroyPooledView(i))},e.prototype._viewDehydrateRecurse=function(e){e.hydrated()&&this._utils.dehydrateView(e);for(var t=e.viewContainers,r=e.viewOffset,n=e.viewOffset+e.mainMergeMapping.nestedViewCountByViewIndex[e.viewOffset],i=e.elementOffset,o=r;n>=o;o++)for(var a=e.views[o],s=0;s=0;u--)this._destroyViewInContainer(a,i,u)}},e=o([s.Injectable(),a("design:paramtypes",[f.AppViewPool,h.AppViewListener,d.AppViewManagerUtils,p.Renderer])],e)}();return t.AppViewManager=m,n.define=i,r.exports}),System.register("angular2/src/core/render/dom/compiler/compiler",["angular2/src/core/di","angular2/src/core/facade/async","angular2/src/core/dom/dom_adapter","angular2/src/core/render/api","angular2/src/core/render/dom/compiler/compile_pipeline","angular2/src/core/facade/exceptions","angular2/src/core/render/dom/compiler/view_loader","angular2/src/core/render/dom/compiler/compile_step_factory","angular2/src/core/render/dom/schema/element_schema_registry","angular2/src/core/change_detection/change_detection","angular2/src/core/render/dom/view/proto_view_merger","angular2/src/core/render/dom/compiler/selector","angular2/src/core/render/dom/dom_tokens","angular2/src/core/render/dom/view/shared_styles_host","angular2/src/core/render/dom/util","angular2/src/core/render/dom/template_cloner"],!0,function(e,t,r){var n=System.global,i=n.define;n.define=void 0;var o=this&&this.__extends||function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);r.prototype=t.prototype,e.prototype=new r},a=this&&this.__decorate||function(e,t,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(e,t,r,n);switch(arguments.length){case 2:return e.reduceRight(function(e,t){return t&&t(e)||e},t);case 3:return e.reduceRight(function(e,n){return void(n&&n(t,r))},void 0);case 4:return e.reduceRight(function(e,n){return n&&n(t,r,e)||e},n)}},s=this&&this.__metadata||function(e,t){return"object"==typeof Reflect&&"function"==typeof Reflect.metadata?Reflect.metadata(e,t):void 0},c=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}},l=e("angular2/src/core/di"),u=e("angular2/src/core/facade/async"),p=e("angular2/src/core/dom/dom_adapter"),d=e("angular2/src/core/render/api"),f=e("angular2/src/core/render/dom/compiler/compile_pipeline"),h=e("angular2/src/core/facade/exceptions"),g=e("angular2/src/core/render/dom/compiler/view_loader"),m=e("angular2/src/core/render/dom/compiler/compile_step_factory"),v=e("angular2/src/core/render/dom/schema/element_schema_registry"),y=e("angular2/src/core/change_detection/change_detection"),_=e("angular2/src/core/render/dom/view/proto_view_merger"),b=e("angular2/src/core/render/dom/compiler/selector"),w=e("angular2/src/core/render/dom/dom_tokens"),C=e("angular2/src/core/render/dom/view/shared_styles_host"),R=e("angular2/src/core/render/dom/util"),E=e("angular2/src/core/render/dom/template_cloner"),P=function(e){function t(t,r,n,i,o){e.call(this),this._schemaRegistry=t,this._templateCloner=r,this._stepFactory=n,this._viewLoader=i,this._sharedStylesHost=o}return o(t,e),t.prototype.compile=function(e){var t=this,r=this._viewLoader.load(e);return u.PromiseWrapper.then(r,function(r){return t._compileView(e,r,d.ViewType.COMPONENT)},function(t){throw new h.BaseException('Failed to load the template for "'+e.componentId+'" : '+t)})},t.prototype.compileHost=function(e){var t=new d.ViewDefinition({componentId:e.id,templateAbsUrl:null,template:null,styles:null,styleAbsUrls:null,directives:[e],encapsulation:d.ViewEncapsulation.None}),r=b.CssSelector.parse(e.selector)[0],n=r.getMatchingElementTemplate(),i=new g.TemplateAndStyles(n,[]);return this._compileView(t,i,d.ViewType.HOST)},t.prototype.mergeProtoViewsRecursively=function(e){return u.PromiseWrapper.resolve(_.mergeProtoViewsRecursively(this._templateCloner,e))},t.prototype._compileView=function(e,t,r){e.encapsulation===d.ViewEncapsulation.Emulated&&0===t.styles.length&&(e=this._normalizeViewEncapsulationIfThereAreNoStyles(e));var n=new f.CompilePipeline(this._stepFactory.createSteps(e)),i=n.processStyles(t.styles),o=n.processElements(this._createTemplateElm(t.template),r,e);return e.encapsulation===d.ViewEncapsulation.Native?R.prependAll(p.DOM.content(o[0].element),i.map(function(e){return p.DOM.createStyleElement(e)})):this._sharedStylesHost.addStyles(i),u.PromiseWrapper.resolve(o[0].inheritedProtoView.build(this._schemaRegistry,this._templateCloner))},t.prototype._createTemplateElm=function(e){for(var t=p.DOM.createTemplate(e),r=p.DOM.querySelectorAll(p.DOM.templateAwareRoot(t),"script"),n=0;n1)throw new l.BaseException("A directive injectable can contain only one of the following @Attribute or @Query.")},t.createFrom=function(e){return new t(e.key,e.optional,e.lowerBoundVisibility,e.upperBoundVisibility,e.properties,t._attributeName(e.properties),t._query(e.properties))},t._attributeName=function(e){var t=p.ListWrapper.find(e,function(e){return e instanceof g.AttributeMetadata});return c.isPresent(t)?t.attributeName:null},t._query=function(e){return p.ListWrapper.find(e,function(e){return e instanceof g.QueryMetadata})},t}(d.Dependency);t.DirectiveDependency=M;var A=function(e){function t(t,r,n,i,o,a){e.call(this,t,[new h.ResolvedFactory(r,n)],!1),this.metadata=i,this.bindings=o,this.viewBindings=a}return s(t,e),Object.defineProperty(t.prototype,"displayName",{get:function(){return this.key.displayName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"callOnDestroy",{get:function(){return this.metadata.callOnDestroy},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"queries",{get:function(){if(c.isBlank(this.metadata.queries))return[];var e=[];return p.StringMapWrapper.forEach(this.metadata.queries,function(t,r){var n=E.reflector.setter(r);e.push(new N(n,t))}),e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventEmitters",{get:function(){return c.isPresent(this.metadata)&&c.isPresent(this.metadata.events)?this.metadata.events:[]},enumerable:!0,configurable:!0}),t.createFromBinding=function(e,r){c.isBlank(r)&&(r=new b.DirectiveMetadata);var n=h.resolveBinding(e),i=n.resolvedFactories[0],o=i.dependencies.map(M.createFrom),a=e.token,s=P.RenderDirectiveMetadata.create({id:c.stringify(e.token),type:r instanceof b.ComponentMetadata?P.RenderDirectiveMetadata.COMPONENT_TYPE:P.RenderDirectiveMetadata.DIRECTIVE_TYPE,selector:r.selector,compileChildren:r.compileChildren,events:r.events,host:c.isPresent(r.host)?p.MapWrapper.createFromStringMap(r.host):null,properties:r.properties,readAttributes:t._readAttributes(o),queries:r.queries,callOnDestroy:w.hasLifecycleHook(D.LifecycleHooks.OnDestroy,a),callOnChanges:w.hasLifecycleHook(D.LifecycleHooks.OnChanges,a),callDoCheck:w.hasLifecycleHook(D.LifecycleHooks.DoCheck,a),callOnInit:w.hasLifecycleHook(D.LifecycleHooks.OnInit,a),callAfterContentInit:w.hasLifecycleHook(D.LifecycleHooks.AfterContentInit,a),callAfterContentChecked:w.hasLifecycleHook(D.LifecycleHooks.AfterContentChecked,a),callAfterViewInit:w.hasLifecycleHook(D.LifecycleHooks.AfterViewInit,a),callAfterViewChecked:w.hasLifecycleHook(D.LifecycleHooks.AfterViewChecked,a),changeDetection:r instanceof b.ComponentMetadata?r.changeDetection:null,exportAs:r.exportAs}),l=c.isPresent(r.bindings)?r.bindings:[],u=r instanceof b.ComponentMetadata&&c.isPresent(r.viewBindings)?r.viewBindings:[];return new t(n.key,i.factory,o,s,l,u)},t._readAttributes=function(e){var t=[];return e.forEach(function(e){c.isPresent(e.attributeName)&&t.push(e.attributeName)}),t},t.createFromType=function(e,r){var n=new d.Binding(e,{toClass:e});return t.createFromBinding(n,r)},t}(d.ResolvedBinding);t.DirectiveBinding=A;var T=function(){function e(e,t,r,n){this.viewManager=e,this.view=t,this.elementRef=r,this.templateRef=n}return e}();t.PreBuiltObjects=T;var N=function(){function e(e,t){this.setter=e,this.metadata=t}return e}();t.QueryMetadataWithSetter=N;var B=function(){function e(e,t){this.eventName=e,this.getter=t}return e.prototype.subscribe=function(e,t,r){var n=this,i=this.getter(r);return u.ObservableWrapper.subscribe(i,function(r){return e.triggerEventHandlers(n.eventName,r,t)})},e}();t.EventEmitterAccessor=B;var k=function(){function e(e,t,r,i,o,a){this.parent=e,this.index=t,this.distanceToParent=i,this._firstBindingIsComponent=o,this.directiveVariableBindings=a;var s=r.length;this.protoInjector=new f.ProtoInjector(r),this.eventEmitterAccessors=p.ListWrapper.createFixedSize(s);for(var c=0;s>c;++c)this.eventEmitterAccessors[c]=n(r[c])}return e.create=function(t,r,n,i,o,a){var s=[];return e._createDirectiveBindingWithVisibility(n,s,i),i&&e._createViewBindingsWithVisibility(n,s),e._createBindingsWithVisibility(n,s),new e(t,r,s,o,i,a)},e._createDirectiveBindingWithVisibility=function(t,r,n){t.forEach(function(i){r.push(e._createBindingWithVisibility(n,i,t,i))})},e._createBindingsWithVisibility=function(e,t){var r=[];e.forEach(function(e){r=p.ListWrapper.concat(r,e.bindings)});var n=d.Injector.resolve(r);n.forEach(function(e){return t.push(new f.BindingWithVisibility(e,f.Visibility.Public))})},e._createBindingWithVisibility=function(e,t,r,n){var i=e&&r[0]===t;return new f.BindingWithVisibility(n,i?f.Visibility.PublicAndPrivate:f.Visibility.Public)},e._createViewBindingsWithVisibility=function(e,t){var r=d.Injector.resolve(e[0].viewBindings);r.forEach(function(e){return t.push(new f.BindingWithVisibility(e,f.Visibility.Private))})},e.prototype.instantiate=function(e){return new j(this,e)},e.prototype.directParent=function(){return this.distanceToParent<2?this.parent:null},Object.defineProperty(e.prototype,"hasBindings",{get:function(){return this.eventEmitterAccessors.length>0},enumerable:!0,configurable:!0}),e.prototype.getBindingAtIndex=function(e){return this.protoInjector.getBindingAtIndex(e)},e}();t.ProtoElementInjector=k;var V=function(){function e(e,t,r){this.element=e,this.componentElement=t,this.injector=r}return e}(),j=function(e){function t(t,r){var n=this;e.call(this,r),this._proto=t,this._preBuiltObjects=null,this._injector=new d.Injector(this._proto.protoInjector,null,this,function(){return n._debugContext()});var i=this._injector.internalStrategy;this._strategy=i instanceof f.InjectorInlineStrategy?new L(i,this):new W(i,this),this.hydrated=!1,this._buildQueries()}return s(t,e),t.prototype.dehydrate=function(){this.hydrated=!1,this._host=null,this._preBuiltObjects=null,this._strategy.callOnDestroy(),this._strategy.dehydrate(),this._clearQueryLists()},t.prototype.hydrate=function(e,t,r){this._host=t,this._preBuiltObjects=r,this._reattachInjectors(e),this._strategy.hydrate(),this.hydrated=!0},t.prototype.updateLocalQueries=function(){c.isPresent(this._query0)&&!this._query0.isViewQuery&&(this._query0.update(),this._query0.list.fireCallbacks()),c.isPresent(this._query1)&&!this._query1.isViewQuery&&(this._query1.update(),this._query1.list.fireCallbacks()),c.isPresent(this._query2)&&!this._query2.isViewQuery&&(this._query2.update(),this._query2.list.fireCallbacks())},t.prototype.updateLocalViewQueries=function(){c.isPresent(this._query0)&&this._query0.isViewQuery&&(this._query0.update(),this._query0.list.fireCallbacks()),c.isPresent(this._query1)&&this._query1.isViewQuery&&(this._query1.update(),this._query1.list.fireCallbacks()),c.isPresent(this._query2)&&this._query2.isViewQuery&&(this._query2.update(),this._query2.list.fireCallbacks())},t.prototype._debugContext=function(){var e=this._preBuiltObjects,t=e.elementRef.boundElementIndex-e.view.elementOffset,r=this._preBuiltObjects.view.getDebugContext(t,null);return c.isPresent(r)?new V(r.element,r.componentElement,r.injector):null},t.prototype._reattachInjectors=function(e){c.isPresent(this._parent)?c.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._parent._injector,!1)):this._reattachInjector(this._injector,this._parent._injector,!1):c.isPresent(this._host)?c.isPresent(e)?(this._reattachInjector(this._injector,e,!1),this._reattachInjector(e,this._host._injector,!0)):this._reattachInjector(this._injector,this._host._injector,!0):c.isPresent(e)&&this._reattachInjector(this._injector,e,!0)},t.prototype._reattachInjector=function(e,t,r){e.internalStrategy.attach(t,r)},t.prototype.hasVariableBinding=function(e){var t=this._proto.directiveVariableBindings;return c.isPresent(t)&&t.has(e)},t.prototype.getVariableBinding=function(e){var t=this._proto.directiveVariableBindings.get(e);return c.isPresent(t)?this.getDirectiveAtIndex(t):this.getElementRef()},t.prototype.get=function(e){return this._injector.get(e)},t.prototype.hasDirective=function(e){return c.isPresent(this._injector.getOptional(e))},t.prototype.getEventEmitterAccessors=function(){return this._proto.eventEmitterAccessors},t.prototype.getDirectiveVariableBindings=function(){return this._proto.directiveVariableBindings},t.prototype.getComponent=function(){return this._strategy.getComponent()},t.prototype.getInjector=function(){return this._injector},t.prototype.getElementRef=function(){return this._preBuiltObjects.elementRef},t.prototype.getViewContainerRef=function(){return new v.ViewContainerRef(this._preBuiltObjects.viewManager,this.getElementRef())},t.prototype.getView=function(){return this._preBuiltObjects.view},t.prototype.directParent=function(){return this._proto.distanceToParent<2?this.parent:null},t.prototype.isComponentKey=function(e){return this._strategy.isComponentKey(e)},t.prototype.getDependency=function(e,t,r){var n=r.key;if(t instanceof A){var i=r,o=t,a=I.instance();if(n.id===a.viewManagerId)return this._preBuiltObjects.viewManager;if(c.isPresent(i.attributeName))return this._buildAttribute(i);if(c.isPresent(i.queryDecorator))return this._findQuery(i.queryDecorator).list;if(i.key.id===I.instance().changeDetectorRefId){if(o.metadata.type===P.RenderDirectiveMetadata.COMPONENT_TYPE){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return this._preBuiltObjects.view.changeDetector.ref}if(i.key.id===I.instance().elementRefId)return this.getElementRef();if(i.key.id===I.instance().viewContainerId)return this.getViewContainerRef();if(i.key.id===I.instance().templateRefId){if(c.isBlank(this._preBuiltObjects.templateRef)){if(i.optional)return null;throw new d.NoBindingError(null,i.key)}return this._preBuiltObjects.templateRef}}else if(t instanceof S.PipeBinding&&r.key.id===I.instance().changeDetectorRefId){var s=this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex);return s.changeDetector.ref}return f.UNDEFINED},t.prototype._buildAttribute=function(e){var t=this._proto.attributes;return c.isPresent(t)&&t.has(e.attributeName)?t.get(e.attributeName):null},t.prototype._buildQueriesForDeps=function(e){for(var t=0;t0?this.list.first:null):this.setter(e,this.list)}},e.prototype._update=function(){var e=[];if(this.query.isViewQuery){var t=this.originator.getView(),r=t.getNestedView(t.elementOffset+this.originator.getBoundElementIndex());c.isPresent(r)&&this._visitView(r,e)}else this._visit(this.originator,e);this.list.reset(e)},e.prototype._visit=function(e,t){for(var r=e.getView(),n=r.elementOffset+e._proto.index,i=n;in&&(c.isBlank(o)||c.isBlank(o.parent)||r.elementOffset+o.parent._proto.index0&&f.isPresent(g.DOM.parentElement(e))){for(var r=0;r0){var i=r[r.length-1],o=_.resolveInternalDomFragment(t);n(i,o),this.animateNodesEnter(o)}},t.prototype.animateNodesEnter=function(e){for(var t=0;t0&&n[0]===o&&(n[0]=t),r.fragments[0][0]=t}for(var a=new y.DomView(e,r.boundTextNodes,n),s=e.elementBinders,c=0;c is used within the recursive path of "+u.stringify(a));if(e.type===P.ViewType.COMPONENT)throw new p.BaseException("Unconditional component cycle in "+u.stringify(a));s(r.get(a))}else{var c=n._compile(o,r);u.isPromise(c)?i.push(c.then(s)):s(c)}})}),d.PromiseWrapper.all(i).then(function(t){return d.PromiseWrapper.all(e.map(function(e){return n._mergeProtoView(e)}))}).then(function(t){return e[0]})},e.prototype._mergeProtoView=function(e){return e.type!==P.ViewType.HOST&&e.type!==P.ViewType.EMBEDDED?null:this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(e)).then(function(t){e.mergeMapping=new g.AppProtoViewMergeMapping(t)})},e.prototype._collectMergeRenderProtoViews=function(e){for(var t=[e.render],r=0;r0?o=this._urlResolver.resolve(i,t.templateUrl):u.isPresent(t.template)&&(o=i),u.isPresent(t.styleUrls)&&(a=f.ListWrapper.map(t.styleUrls,function(e){return n._urlResolver.resolve(i,e)})),new P.ViewDefinition({componentId:u.stringify(e),templateAbsUrl:o,template:t.template,styleAbsUrls:a,styles:t.styles,directives:f.ListWrapper.map(r,function(e){return e.metadata}),encapsulation:t.encapsulation})},e.prototype._flattenPipes=function(e){if(u.isBlank(e.pipes))return this._defaultPipes;var t=f.ListWrapper.clone(this._defaultPipes);return this._flattenList(e.pipes,t),t},e.prototype._flattenDirectives=function(e){if(u.isBlank(e.directives))return[];var t=[];return this._flattenList(e.directives,t),t},e.prototype._flattenList=function(e,t){for(var r=0;r= 0; i--) { + var group = groups[i]; + for (var j = 0; j < group.length; j++) { + var entry = group[j]; + + // link each group + if (curGroupDeclarative) + linkDeclarativeModule(entry); + else + linkDynamicModule(entry); + } + curGroupDeclarative = !curGroupDeclarative; + } + } + + // module binding records + var moduleRecords = {}; + function getOrCreateModuleRecord(name) { + return moduleRecords[name] || (moduleRecords[name] = { + name: name, + dependencies: [], + exports: {}, // start from an empty module and extend + importers: [] + }) + } + + function linkDeclarativeModule(entry) { + // only link if already not already started linking (stops at circular) + if (entry.module) + return; + + var module = entry.module = getOrCreateModuleRecord(entry.name); + var exports = entry.module.exports; + + var declaration = entry.declare.call(global, function(name, value) { + module.locked = true; + exports[name] = value; + + for (var i = 0, l = module.importers.length; i < l; i++) { + var importerModule = module.importers[i]; + if (!importerModule.locked) { + var importerIndex = indexOf.call(importerModule.dependencies, module); + importerModule.setters[importerIndex](exports); + } + } + + module.locked = false; + return value; + }); + + module.setters = declaration.setters; + module.execute = declaration.execute; + + if (!module.setters || !module.execute) + throw new TypeError("Invalid System.register form for " + entry.name); + + // now link all the module dependencies + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + var depModule = moduleRecords[depName]; + + // work out how to set depExports based on scenarios... + var depExports; + + if (depModule) { + depExports = depModule.exports; + } + else if (depEntry && !depEntry.declarative) { + if (depEntry.module.exports && depEntry.module.exports.__esModule) + depExports = depEntry.module.exports; + else + depExports = { 'default': depEntry.module.exports, __useDefault: true }; + } + // in the module registry + else if (!depEntry) { + depExports = load(depName); + } + // we have an entry -> link + else { + linkDeclarativeModule(depEntry); + depModule = depEntry.module; + depExports = depModule.exports; + } + + // only declarative modules have dynamic bindings + if (depModule && depModule.importers) { + depModule.importers.push(module); + module.dependencies.push(depModule); + } + else + module.dependencies.push(null); + + // run the setter for this dependency + if (module.setters[i]) + module.setters[i](depExports); + } + } + + // An analog to loader.get covering execution of all three layers (real declarative, simulated declarative, simulated dynamic) + function getModule(name) { + var exports; + var entry = defined[name]; + + if (!entry) { + exports = load(name); + if (!exports) + throw new Error("Unable to load dependency " + name + "."); + } + + else { + if (entry.declarative) + ensureEvaluated(name, []); + + else if (!entry.evaluated) + linkDynamicModule(entry); + + exports = entry.module.exports; + } + + if ((!entry || entry.declarative) && exports && exports.__useDefault) + return exports['default']; + + return exports; + } + + function linkDynamicModule(entry) { + if (entry.module) + return; + + var exports = {}; + + var module = entry.module = { exports: exports, id: entry.name }; + + // AMD requires execute the tree first + if (!entry.executingRequire) { + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + var depEntry = defined[depName]; + if (depEntry) + linkDynamicModule(depEntry); + } + } + + // now execute + entry.evaluated = true; + var output = entry.execute.call(global, function(name) { + for (var i = 0, l = entry.deps.length; i < l; i++) { + if (entry.deps[i] != name) + continue; + return getModule(entry.normalizedDeps[i]); + } + throw new TypeError('Module ' + name + ' not declared as a dependency.'); + }, exports, module); + + if (output) + module.exports = output; + } + + /* + * Given a module, and the list of modules for this current branch, + * ensure that each of the dependencies of this module is evaluated + * (unless one is a circular dependency already in the list of seen + * modules, in which case we execute it) + * + * Then we evaluate the module itself depth-first left to right + * execution to match ES6 modules + */ + function ensureEvaluated(moduleName, seen) { + var entry = defined[moduleName]; + + // if already seen, that means it's an already-evaluated non circular dependency + if (!entry || entry.evaluated || !entry.declarative) + return; + + // this only applies to declarative modules which late-execute + + seen.push(moduleName); + + for (var i = 0, l = entry.normalizedDeps.length; i < l; i++) { + var depName = entry.normalizedDeps[i]; + if (indexOf.call(seen, depName) == -1) { + if (!defined[depName]) + load(depName); + else + ensureEvaluated(depName, seen); + } + } + + if (entry.evaluated) + return; + + entry.evaluated = true; + entry.module.execute.call(global); + } + + // magical execution function + var modules = {}; + function load(name) { + if (modules[name]) + return modules[name]; + + var entry = defined[name]; + + // first we check if this module has already been defined in the registry + if (!entry) + throw "Module " + name + " not present."; + + // recursively ensure that the module and all its + // dependencies are linked (with dependency group handling) + link(name); + + // now handle dependency execution in correct order + ensureEvaluated(name, []); + + // remove from the registry + defined[name] = undefined; + + var module = entry.module.exports; + + if (!module || !entry.declarative && module.__esModule !== true) + module = { 'default': module, __useDefault: true }; + + // return the defined module object + return modules[name] = module; + }; + + return function(mains, declare) { + + var System; + var System = { + register: register, + get: load, + set: function(name, module) { + modules[name] = module; + }, + newModule: function(module) { + return module; + }, + global: global + }; + System.set('@empty', {}); + + declare(System); + + for (var i = 0; i < mains.length; i++) + load(mains[i]); + } + +})(typeof window != 'undefined' ? window : global) +/* (['mainModule'], function(System) { + System.register(...); +}); */ + +(['angular2/http'], function(System) { + +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/platform_bindings", ["angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + exports.EXCEPTION_BINDING = di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM, false); + }, []); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/bootstrap", ["angular2/src/core/application_common"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_common_1 = require("angular2/src/core/application_common"); + exports.bootstrap = application_common_1.commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/url_search_params", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + function paramParser(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + var map = new collection_1.Map(); + if (rawParams.length > 0) { + var params = lang_1.StringWrapper.split(rawParams, new RegExp('&')); + collection_1.ListWrapper.forEach(params, function(param) { + var split = lang_1.StringWrapper.split(param, new RegExp('=')); + var key = split[0]; + var val = split[1]; + var list = lang_1.isPresent(map.get(key)) ? map.get(key) : []; + list.push(val); + map.set(key, list); + }); + } + return map; + } + exports.URLSearchParamsUnionFixer = lang_1.CONST_EXPR("UnionFixer"); + var URLSearchParams = (function() { + function URLSearchParams(rawParams) { + if (rawParams === void 0) { + rawParams = ''; + } + this.rawParams = rawParams; + this.paramsMap = paramParser(rawParams); + } + URLSearchParams.prototype.clone = function() { + var clone = new URLSearchParams(); + clone.appendAll(this); + return clone; + }; + URLSearchParams.prototype.has = function(param) { + return this.paramsMap.has(param); + }; + URLSearchParams.prototype.get = function(param) { + var storedParam = this.paramsMap.get(param); + if (collection_1.isListLikeIterable(storedParam)) { + return collection_1.ListWrapper.first(storedParam); + } else { + return null; + } + }; + URLSearchParams.prototype.getAll = function(param) { + var mapParam = this.paramsMap.get(param); + return lang_1.isPresent(mapParam) ? mapParam : []; + }; + URLSearchParams.prototype.set = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.setAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + list.push(value[0]); + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.append = function(param, val) { + var mapParam = this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + list.push(val); + this.paramsMap.set(param, list); + }; + URLSearchParams.prototype.appendAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.replaceAll = function(searchParams) { + var _this = this; + collection_1.MapWrapper.forEach(searchParams.paramsMap, function(value, param) { + var mapParam = _this.paramsMap.get(param); + var list = lang_1.isPresent(mapParam) ? mapParam : []; + collection_1.ListWrapper.clear(list); + for (var i = 0; i < value.length; ++i) { + list.push(value[i]); + } + _this.paramsMap.set(param, list); + }); + }; + URLSearchParams.prototype.toString = function() { + var paramsList = []; + collection_1.MapWrapper.forEach(this.paramsMap, function(values, k) { + collection_1.ListWrapper.forEach(values, function(v) { + paramsList.push(k + '=' + v); + }); + }); + return collection_1.ListWrapper.join(paramsList, '&'); + }; + URLSearchParams.prototype.delete = function(param) { + collection_1.MapWrapper.delete(this.paramsMap, param); + }; + return URLSearchParams; + })(); + exports.URLSearchParams = URLSearchParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/headers", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Headers = (function() { + function Headers(headers) { + var _this = this; + if (lang_1.isBlank(headers)) { + this._headersMap = new collection_1.Map(); + return ; + } + if (headers instanceof Headers) { + this._headersMap = headers._headersMap; + } else if (headers instanceof collection_1.StringMap) { + this._headersMap = collection_1.MapWrapper.createFromStringMap(headers); + collection_1.MapWrapper.forEach(this._headersMap, function(v, k) { + if (!collection_1.isListLikeIterable(v)) { + var list = []; + list.push(v); + _this._headersMap.set(k, list); + } + }); + } + } + Headers.prototype.append = function(name, value) { + var mapName = this._headersMap.get(name); + var list = collection_1.isListLikeIterable(mapName) ? mapName : []; + list.push(value); + this._headersMap.set(name, list); + }; + Headers.prototype.delete = function(name) { + collection_1.MapWrapper.delete(this._headersMap, name); + }; + Headers.prototype.forEach = function(fn) { + collection_1.MapWrapper.forEach(this._headersMap, fn); + }; + Headers.prototype.get = function(header) { + return collection_1.ListWrapper.first(this._headersMap.get(header)); + }; + Headers.prototype.has = function(header) { + return this._headersMap.has(header); + }; + Headers.prototype.keys = function() { + return collection_1.MapWrapper.keys(this._headersMap); + }; + Headers.prototype.set = function(header, value) { + var list = []; + if (collection_1.isListLikeIterable(value)) { + var pushValue = value.join(','); + list.push(pushValue); + } else { + list.push(value); + } + this._headersMap.set(header, list); + }; + Headers.prototype.values = function() { + return collection_1.MapWrapper.values(this._headersMap); + }; + Headers.prototype.getAll = function(header) { + var headers = this._headersMap.get(header); + return collection_1.isListLikeIterable(headers) ? headers : []; + }; + Headers.prototype.entries = function() { + throw new exceptions_1.BaseException('"entries" method is not implemented on Headers class'); + }; + return Headers; + })(); + exports.Headers = Headers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/enums", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RequestMethods) { + RequestMethods[RequestMethods["Get"] = 0] = "Get"; + RequestMethods[RequestMethods["Post"] = 1] = "Post"; + RequestMethods[RequestMethods["Put"] = 2] = "Put"; + RequestMethods[RequestMethods["Delete"] = 3] = "Delete"; + RequestMethods[RequestMethods["Options"] = 4] = "Options"; + RequestMethods[RequestMethods["Head"] = 5] = "Head"; + RequestMethods[RequestMethods["Patch"] = 6] = "Patch"; + })(exports.RequestMethods || (exports.RequestMethods = {})); + var RequestMethods = exports.RequestMethods; + (function(ReadyStates) { + ReadyStates[ReadyStates["Unsent"] = 0] = "Unsent"; + ReadyStates[ReadyStates["Open"] = 1] = "Open"; + ReadyStates[ReadyStates["HeadersReceived"] = 2] = "HeadersReceived"; + ReadyStates[ReadyStates["Loading"] = 3] = "Loading"; + ReadyStates[ReadyStates["Done"] = 4] = "Done"; + ReadyStates[ReadyStates["Cancelled"] = 5] = "Cancelled"; + })(exports.ReadyStates || (exports.ReadyStates = {})); + var ReadyStates = exports.ReadyStates; + (function(ResponseTypes) { + ResponseTypes[ResponseTypes["Basic"] = 0] = "Basic"; + ResponseTypes[ResponseTypes["Cors"] = 1] = "Cors"; + ResponseTypes[ResponseTypes["Default"] = 2] = "Default"; + ResponseTypes[ResponseTypes["Error"] = 3] = "Error"; + ResponseTypes[ResponseTypes["Opaque"] = 4] = "Opaque"; + })(exports.ResponseTypes || (exports.ResponseTypes = {})); + var ResponseTypes = exports.ResponseTypes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http_utils", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.isJsObject = lang_1.isJsObject; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_response_options", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var ResponseOptions = (function() { + function ResponseOptions(_a) { + var _b = _a === void 0 ? {} : _a, + body = _b.body, + status = _b.status, + headers = _b.headers, + statusText = _b.statusText, + type = _b.type, + url = _b.url; + this.body = lang_1.isPresent(body) ? body : null; + this.status = lang_1.isPresent(status) ? status : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.statusText = lang_1.isPresent(statusText) ? statusText : null; + this.type = lang_1.isPresent(type) ? type : null; + this.url = lang_1.isPresent(url) ? url : null; + } + ResponseOptions.prototype.merge = function(options) { + return new ResponseOptions({ + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + status: lang_1.isPresent(options) && lang_1.isPresent(options.status) ? options.status : this.status, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + statusText: lang_1.isPresent(options) && lang_1.isPresent(options.statusText) ? options.statusText : this.statusText, + type: lang_1.isPresent(options) && lang_1.isPresent(options.type) ? options.type : this.type, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url + }); + }; + return ResponseOptions; + })(); + exports.ResponseOptions = ResponseOptions; + var BaseResponseOptions = (function(_super) { + __extends(BaseResponseOptions, _super); + function BaseResponseOptions() { + _super.call(this, { + status: 200, + statusText: 'Ok', + type: enums_1.ResponseTypes.Default, + headers: new headers_1.Headers() + }); + } + BaseResponseOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseResponseOptions); + return BaseResponseOptions; + })(ResponseOptions); + exports.BaseResponseOptions = BaseResponseOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_xhr", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 BrowserXhr = (function() { + function BrowserXhr() {} + BrowserXhr.prototype.build = function() { + return (new XMLHttpRequest()); + }; + BrowserXhr = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserXhr); + return BrowserXhr; + })(); + exports.BrowserXhr = BrowserXhr; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/browser_jsonp", ["angular2/src/core/di", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var _nextRequestId = 0; + exports.JSONP_HOME = '__ng_jsonp__'; + var _jsonpConnections = null; + function _getJsonpConnections() { + if (_jsonpConnections === null) { + _jsonpConnections = lang_1.global[exports.JSONP_HOME] = {}; + } + return _jsonpConnections; + } + var BrowserJsonp = (function() { + function BrowserJsonp() {} + BrowserJsonp.prototype.build = function(url) { + var node = document.createElement('script'); + node.src = url; + return node; + }; + BrowserJsonp.prototype.nextRequestID = function() { + return "__req" + _nextRequestId++; + }; + BrowserJsonp.prototype.requestCallback = function(id) { + return exports.JSONP_HOME + "." + id + ".finished"; + }; + BrowserJsonp.prototype.exposeConnection = function(id, connection) { + var connections = _getJsonpConnections(); + connections[id] = connection; + }; + BrowserJsonp.prototype.removeConnection = function(id) { + var connections = _getJsonpConnections(); + connections[id] = null; + }; + BrowserJsonp.prototype.send = function(node) { + document.body.appendChild((node)); + }; + BrowserJsonp.prototype.cleanup = function(node) { + if (node.parentNode) { + node.parentNode.removeChild((node)); + } + }; + BrowserJsonp = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BrowserJsonp); + return BrowserJsonp; + })(); + exports.BrowserJsonp = BrowserJsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/mock_backend", ["angular2/src/core/di", "angular2/src/http/static_request", "angular2/src/http/enums", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 static_request_1 = require("angular2/src/http/static_request"); + var enums_1 = require("angular2/src/http/enums"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var MockConnection = (function() { + function MockConnection(req) { + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Open; + this.request = req; + } + MockConnection.prototype.dispose = function() { + if (this.readyState !== enums_1.ReadyStates.Done) { + this.readyState = enums_1.ReadyStates.Cancelled; + } + }; + MockConnection.prototype.mockRespond = function(res) { + if (this.readyState === enums_1.ReadyStates.Done || this.readyState === enums_1.ReadyStates.Cancelled) { + throw new exceptions_1.BaseException('Connection has already been resolved'); + } + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callNext(this.response, res); + async_1.ObservableWrapper.callReturn(this.response); + }; + MockConnection.prototype.mockDownload = function(res) {}; + MockConnection.prototype.mockError = function(err) { + this.readyState = enums_1.ReadyStates.Done; + async_1.ObservableWrapper.callThrow(this.response, err); + async_1.ObservableWrapper.callReturn(this.response); + }; + return MockConnection; + })(); + exports.MockConnection = MockConnection; + var MockBackend = (function() { + function MockBackend() { + var _this = this; + this.connectionsArray = []; + this.connections = new async_1.EventEmitter(); + async_1.ObservableWrapper.subscribe(this.connections, function(connection) { + return _this.connectionsArray.push(connection); + }); + this.pendingConnections = new async_1.EventEmitter(); + } + MockBackend.prototype.verifyNoPendingRequests = function() { + var pending = 0; + async_1.ObservableWrapper.subscribe(this.pendingConnections, function(c) { + return pending++; + }); + if (pending > 0) + throw new exceptions_1.BaseException(pending + " pending connections to be resolved"); + }; + MockBackend.prototype.resolveAllConnections = function() { + async_1.ObservableWrapper.subscribe(this.connections, function(c) { + return c.readyState = 4; + }); + }; + MockBackend.prototype.createConnection = function(req) { + if (!lang_1.isPresent(req) || !(req instanceof static_request_1.Request)) { + throw new exceptions_1.BaseException("createConnection requires an instance of Request, got " + req); + } + var connection = new MockConnection(req); + async_1.ObservableWrapper.callNext(this.connections, connection); + return connection; + }; + MockBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockBackend); + return MockBackend; + })(); + exports.MockBackend = MockBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/browser_testability", ["angular2/src/core/testability/testability", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var testability_1 = require("angular2/src/core/testability/testability"); + var lang_1 = require("angular2/src/core/facade/lang"); + var PublicTestability = (function() { + function PublicTestability(testability) { + this._testability = testability; + } + PublicTestability.prototype.whenStable = function(callback) { + this._testability.whenStable(callback); + }; + PublicTestability.prototype.findBindings = function(using, binding, exactMatch) { + return this._testability.findBindings(using, binding, exactMatch); + }; + return PublicTestability; + })(); + var BrowserGetTestability = (function() { + function BrowserGetTestability() {} + BrowserGetTestability.init = function() { + testability_1.setTestabilityGetter(new BrowserGetTestability()); + }; + BrowserGetTestability.prototype.addToWindow = function(registry) { + lang_1.global.getAngularTestability = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + var testability = registry.findTestabilityInTree(elem, findInAncestors); + if (testability == null) { + throw new Error('Could not find testability for element.'); + } + return new PublicTestability(testability); + }; + lang_1.global.getAllAngularTestabilities = function() { + var testabilities = registry.getAllTestabilities(); + return testabilities.map(function(testability) { + return new PublicTestability(testability); + }); + }; + }; + return BrowserGetTestability; + })(); + exports.BrowserGetTestability = BrowserGetTestability; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/interfaces", ["angular2/src/core/facade/exceptions", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var URLSearchParams_UnionFixer = url_search_params_1.URLSearchParamsUnionFixer; + var ConnectionBackend = (function() { + function ConnectionBackend() {} + ConnectionBackend.prototype.createConnection = function(request) { + throw new exceptions_1.BaseException('Abstract!'); + }; + return ConnectionBackend; + })(); + exports.ConnectionBackend = ConnectionBackend; + var Connection = (function() { + function Connection() {} + Connection.prototype.dispose = function() { + throw new exceptions_1.BaseException('Abstract!'); + }; + return Connection; + })(); + exports.Connection = Connection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_request", ["angular2/src/http/headers", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var headers_1 = require("angular2/src/http/headers"); + var lang_1 = require("angular2/src/core/facade/lang"); + var Request = (function() { + function Request(requestOptions) { + var url = requestOptions.url; + this.url = requestOptions.url; + if (lang_1.isPresent(requestOptions.search)) { + var search = requestOptions.search.toString(); + if (search.length > 0) { + var prefix = '?'; + if (lang_1.StringWrapper.contains(this.url, '?')) { + prefix = (this.url[this.url.length - 1] == '&') ? '' : '&'; + } + this.url = url + prefix + search; + } + } + this._body = requestOptions.body; + this.method = requestOptions.method; + this.headers = new headers_1.Headers(requestOptions.headers); + } + Request.prototype.text = function() { + return lang_1.isPresent(this._body) ? this._body.toString() : ''; + }; + return Request; + })(); + exports.Request = Request; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/base_request_options", ["angular2/src/core/facade/lang", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/core/di", "angular2/src/http/url_search_params"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var headers_1 = require("angular2/src/http/headers"); + var enums_1 = require("angular2/src/http/enums"); + var di_1 = require("angular2/src/core/di"); + var url_search_params_1 = require("angular2/src/http/url_search_params"); + var RequestOptions = (function() { + function RequestOptions(_a) { + var _b = _a === void 0 ? {} : _a, + method = _b.method, + headers = _b.headers, + body = _b.body, + url = _b.url, + search = _b.search; + this.method = lang_1.isPresent(method) ? method : null; + this.headers = lang_1.isPresent(headers) ? headers : null; + this.body = lang_1.isPresent(body) ? body : null; + this.url = lang_1.isPresent(url) ? url : null; + this.search = lang_1.isPresent(search) ? (lang_1.isString(search) ? new url_search_params_1.URLSearchParams((search)) : (search)) : null; + } + RequestOptions.prototype.merge = function(options) { + return new RequestOptions({ + method: lang_1.isPresent(options) && lang_1.isPresent(options.method) ? options.method : this.method, + headers: lang_1.isPresent(options) && lang_1.isPresent(options.headers) ? options.headers : this.headers, + body: lang_1.isPresent(options) && lang_1.isPresent(options.body) ? options.body : this.body, + url: lang_1.isPresent(options) && lang_1.isPresent(options.url) ? options.url : this.url, + search: lang_1.isPresent(options) && lang_1.isPresent(options.search) ? (lang_1.isString(options.search) ? new url_search_params_1.URLSearchParams((options.search)) : (options.search).clone()) : this.search + }); + }; + return RequestOptions; + })(); + exports.RequestOptions = RequestOptions; + var BaseRequestOptions = (function(_super) { + __extends(BaseRequestOptions, _super); + function BaseRequestOptions() { + _super.call(this, { + method: enums_1.RequestMethods.Get, + headers: new headers_1.Headers() + }); + } + BaseRequestOptions = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], BaseRequestOptions); + return BaseRequestOptions; + })(RequestOptions); + exports.BaseRequestOptions = BaseRequestOptions; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/static_response", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/http/http_utils"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var http_utils_1 = require("angular2/src/http/http_utils"); + var Response = (function() { + function Response(responseOptions) { + this._body = responseOptions.body; + this.status = responseOptions.status; + this.statusText = responseOptions.statusText; + this.headers = responseOptions.headers; + this.type = responseOptions.type; + this.url = responseOptions.url; + } + Response.prototype.blob = function() { + throw new exceptions_1.BaseException('"blob()" method not implemented on Response superclass'); + }; + Response.prototype.json = function() { + var jsonResponse; + if (http_utils_1.isJsObject(this._body)) { + jsonResponse = this._body; + } else if (lang_1.isString(this._body)) { + jsonResponse = lang_1.Json.parse(this._body); + } + return jsonResponse; + }; + Response.prototype.text = function() { + return this._body.toString(); + }; + Response.prototype.arrayBuffer = function() { + throw new exceptions_1.BaseException('"arrayBuffer()" method not implemented on Response superclass'); + }; + return Response; + })(); + exports.Response = Response; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/jsonp_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_jsonp", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var async_1 = require("angular2/src/core/facade/async"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var JSONPConnection = (function() { + function JSONPConnection(req, _dom, baseResponseOptions) { + var _this = this; + this._dom = _dom; + this.baseResponseOptions = baseResponseOptions; + this._finished = false; + if (req.method !== enums_1.RequestMethods.Get) { + throw exceptions_1.makeTypeError("JSONP requests must use GET request method."); + } + this.request = req; + this.response = new async_1.EventEmitter(); + this.readyState = enums_1.ReadyStates.Loading; + this._id = _dom.nextRequestID(); + _dom.exposeConnection(this._id, this); + var callback = _dom.requestCallback(this._id); + var url = req.url; + if (url.indexOf('=JSONP_CALLBACK&') > -1) { + url = lang_1.StringWrapper.replace(url, '=JSONP_CALLBACK&', "=" + callback + "&"); + } else if (url.lastIndexOf('=JSONP_CALLBACK') === url.length - '=JSONP_CALLBACK'.length) { + url = lang_1.StringWrapper.substring(url, 0, url.length - '=JSONP_CALLBACK'.length) + ("=" + callback); + } + var script = this._script = _dom.build(url); + script.addEventListener('load', function(event) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + if (!_this._finished) { + async_1.ObservableWrapper.callThrow(_this.response, exceptions_1.makeTypeError('JSONP injected script did not invoke callback.')); + return ; + } + var responseOptions = new base_response_options_1.ResponseOptions({body: _this._responseData}); + if (lang_1.isPresent(_this.baseResponseOptions)) { + responseOptions = _this.baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + }); + script.addEventListener('error', function(error) { + if (_this.readyState === enums_1.ReadyStates.Cancelled) + return ; + _this.readyState = enums_1.ReadyStates.Done; + _dom.cleanup(script); + async_1.ObservableWrapper.callThrow(_this.response, error); + }); + _dom.send(script); + } + JSONPConnection.prototype.finished = function(data) { + this._finished = true; + this._dom.removeConnection(this._id); + if (this.readyState === enums_1.ReadyStates.Cancelled) + return ; + this._responseData = data; + }; + JSONPConnection.prototype.dispose = function() { + this.readyState = enums_1.ReadyStates.Cancelled; + var script = this._script; + this._script = null; + if (lang_1.isPresent(script)) { + this._dom.cleanup(script); + } + async_1.ObservableWrapper.callReturn(this.response); + }; + return JSONPConnection; + })(); + exports.JSONPConnection = JSONPConnection; + var JSONPBackend = (function() { + function JSONPBackend(_browserJSONP, _baseResponseOptions) { + this._browserJSONP = _browserJSONP; + this._baseResponseOptions = _baseResponseOptions; + } + JSONPBackend.prototype.createConnection = function(request) { + return new JSONPConnection(request, this._browserJSONP, this._baseResponseOptions); + }; + JSONPBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_jsonp_1.BrowserJsonp, base_response_options_1.ResponseOptions])], JSONPBackend); + return JSONPBackend; + })(); + exports.JSONPBackend = JSONPBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/http", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/decorators", "angular2/src/http/interfaces", "angular2/src/http/static_request", "angular2/src/http/base_request_options", "angular2/src/http/enums"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var decorators_1 = require("angular2/src/core/di/decorators"); + var interfaces_1 = require("angular2/src/http/interfaces"); + var static_request_1 = require("angular2/src/http/static_request"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var enums_1 = require("angular2/src/http/enums"); + function httpRequest(backend, request) { + return backend.createConnection(request).response; + } + function mergeOptions(defaultOpts, providedOpts, method, url) { + var newOptions = defaultOpts; + if (lang_1.isPresent(providedOpts)) { + newOptions = newOptions.merge(new base_request_options_1.RequestOptions({ + method: providedOpts.method, + url: providedOpts.url, + search: providedOpts.search, + headers: providedOpts.headers, + body: providedOpts.body, + mode: providedOpts.mode, + credentials: providedOpts.credentials, + cache: providedOpts.cache + })); + } + if (lang_1.isPresent(method)) { + return newOptions.merge(new base_request_options_1.RequestOptions({ + method: method, + url: url + })); + } else { + return newOptions.merge(new base_request_options_1.RequestOptions({url: url})); + } + } + var Http = (function() { + function Http(_backend, _defaultOptions) { + this._backend = _backend; + this._defaultOptions = _defaultOptions; + } + Http.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + responseObservable = httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + } else if (url instanceof static_request_1.Request) { + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Http.prototype.get = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url))); + }; + Http.prototype.post = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Post, url))); + }; + Http.prototype.put = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Put, url))); + }; + Http.prototype.delete = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Delete, url))); + }; + Http.prototype.patch = function(url, body, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions.merge(new base_request_options_1.RequestOptions({body: body})), options, enums_1.RequestMethods.Patch, url))); + }; + Http.prototype.head = function(url, options) { + return httpRequest(this._backend, new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Head, url))); + }; + Http = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Http); + return Http; + })(); + exports.Http = Http; + var Jsonp = (function(_super) { + __extends(Jsonp, _super); + function Jsonp(backend, defaultOptions) { + _super.call(this, backend, defaultOptions); + } + Jsonp.prototype.request = function(url, options) { + var responseObservable; + if (lang_1.isString(url)) { + url = new static_request_1.Request(mergeOptions(this._defaultOptions, options, enums_1.RequestMethods.Get, url)); + } + if (url instanceof static_request_1.Request) { + if (url.method !== enums_1.RequestMethods.Get) { + exceptions_1.makeTypeError('JSONP requests must use GET request method.'); + } + responseObservable = httpRequest(this._backend, url); + } else { + throw exceptions_1.makeTypeError('First argument must be a url string or Request instance.'); + } + return responseObservable; + }; + Jsonp = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ConnectionBackend, base_request_options_1.RequestOptions])], Jsonp); + return Jsonp; + })(Http); + exports.Jsonp = Jsonp; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/http/backends/xhr_backend", ["angular2/src/http/enums", "angular2/src/http/static_response", "angular2/src/http/base_response_options", "angular2/src/core/di", "angular2/src/http/backends/browser_xhr", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var enums_1 = require("angular2/src/http/enums"); + var static_response_1 = require("angular2/src/http/static_response"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var di_1 = require("angular2/src/core/di"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var XHRConnection = (function() { + function XHRConnection(req, browserXHR, baseResponseOptions) { + var _this = this; + this.request = req; + this.response = new async_1.EventEmitter(); + this._xhr = browserXHR.build(); + this._xhr.open(enums_1.RequestMethods[req.method].toUpperCase(), req.url); + this._xhr.addEventListener('load', function(_) { + var response = lang_1.isPresent(_this._xhr.response) ? _this._xhr.response : _this._xhr.responseText; + var status = _this._xhr.status === 1223 ? 204 : _this._xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + var responseOptions = new base_response_options_1.ResponseOptions({ + body: response, + status: status + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callNext(_this.response, new static_response_1.Response(responseOptions)); + async_1.ObservableWrapper.callReturn(_this.response); + }); + this._xhr.addEventListener('error', function(err) { + var responseOptions = new base_response_options_1.ResponseOptions({ + body: err, + type: enums_1.ResponseTypes.Error + }); + if (lang_1.isPresent(baseResponseOptions)) { + responseOptions = baseResponseOptions.merge(responseOptions); + } + async_1.ObservableWrapper.callThrow(_this.response, new static_response_1.Response(responseOptions)); + }); + if (lang_1.isPresent(req.headers)) { + req.headers.forEach(function(value, name) { + _this._xhr.setRequestHeader(name, value); + }); + } + this._xhr.send(this.request.text()); + } + XHRConnection.prototype.dispose = function() { + this._xhr.abort(); + }; + return XHRConnection; + })(); + exports.XHRConnection = XHRConnection; + var XHRBackend = (function() { + function XHRBackend(_browserXHR, _baseResponseOptions) { + this._browserXHR = _browserXHR; + this._baseResponseOptions = _baseResponseOptions; + } + XHRBackend.prototype.createConnection = function(request) { + return new XHRConnection(request, this._browserXHR, this._baseResponseOptions); + }; + XHRBackend = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_xhr_1.BrowserXhr, base_response_options_1.ResponseOptions])], XHRBackend); + return XHRBackend; + })(); + exports.XHRBackend = XHRBackend; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_common", ["angular2/src/core/forms", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/dom/browser_adapter", "angular2/src/core/testability/browser_testability", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/testability/testability", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/platform_bindings", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/profile/wtf_init", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var forms_1 = require("angular2/src/core/forms"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var browser_testability_1 = require("angular2/src/core/testability/browser_testability"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var testability_1 = require("angular2/src/core/testability/testability"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var platform_bindings_1 = require("angular2/src/core/platform_bindings"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var application_ref_1 = require("angular2/src/core/application_ref"); + function applicationDomBindings() { + if (lang_1.isBlank(dom_adapter_1.DOM)) { + throw "Must set a root DOM adapter first."; + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), view_loader_1.ViewLoader, platform_bindings_1.EXCEPTION_BINDING, di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), style_inliner_1.StyleInliner, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder, forms_1.FORM_BINDINGS]; + } + exports.applicationDomBindings = applicationDomBindings; + function platform(bindings) { + return application_ref_1.platformCommon(bindings, function() { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + wtf_init_1.wtfInit(); + browser_testability_1.BrowserGetTestability.init(); + }); + } + exports.platform = platform; + function commonBootstrap(appComponentType, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var p = platform(); + var bindings = [application_ref_1.applicationCommonBindings(), applicationDomBindings()]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + return p.application(bindings).bootstrap(appComponentType); + } + exports.commonBootstrap = commonBootstrap; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application", ["angular2/src/core/application_tokens", "angular2/src/core/application_common", "angular2/src/core/application_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var application_tokens_1 = require("angular2/src/core/application_tokens"); + exports.APP_COMPONENT = application_tokens_1.APP_COMPONENT; + var application_common_1 = require("angular2/src/core/application_common"); + exports.platform = application_common_1.platform; + exports.bootstrap = application_common_1.commonBootstrap; + var application_ref_1 = require("angular2/src/core/application_ref"); + exports.PlatformRef = application_ref_1.PlatformRef; + exports.ApplicationRef = application_ref_1.ApplicationRef; + exports.applicationCommonBindings = application_ref_1.applicationCommonBindings; + exports.createNgZone = application_ref_1.createNgZone; + exports.platformCommon = application_ref_1.platformCommon; + exports.platformBindings = application_ref_1.platformBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/core", ["angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application", "angular2/src/core/bootstrap", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application")); + __export(require("angular2/src/core/bootstrap")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/core/render")); + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/http", ["angular2/core", "angular2/src/http/http", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/backends/browser_xhr", "angular2/src/http/backends/browser_jsonp", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/mock_backend", "angular2/src/http/static_request", "angular2/src/http/static_response", "angular2/src/http/interfaces", "angular2/src/http/backends/browser_xhr", "angular2/src/http/base_request_options", "angular2/src/http/base_response_options", "angular2/src/http/backends/xhr_backend", "angular2/src/http/backends/jsonp_backend", "angular2/src/http/http", "angular2/src/http/headers", "angular2/src/http/enums", "angular2/src/http/url_search_params"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var core_1 = require("angular2/core"); + var http_1 = require("angular2/src/http/http"); + var xhr_backend_1 = require("angular2/src/http/backends/xhr_backend"); + var jsonp_backend_1 = require("angular2/src/http/backends/jsonp_backend"); + var browser_xhr_1 = require("angular2/src/http/backends/browser_xhr"); + var browser_jsonp_1 = require("angular2/src/http/backends/browser_jsonp"); + var base_request_options_1 = require("angular2/src/http/base_request_options"); + var base_response_options_1 = require("angular2/src/http/base_response_options"); + var mock_backend_1 = require("angular2/src/http/backends/mock_backend"); + exports.MockConnection = mock_backend_1.MockConnection; + exports.MockBackend = mock_backend_1.MockBackend; + var static_request_1 = require("angular2/src/http/static_request"); + exports.Request = static_request_1.Request; + var static_response_1 = require("angular2/src/http/static_response"); + exports.Response = static_response_1.Response; + var interfaces_1 = require("angular2/src/http/interfaces"); + exports.Connection = interfaces_1.Connection; + exports.ConnectionBackend = interfaces_1.ConnectionBackend; + var browser_xhr_2 = require("angular2/src/http/backends/browser_xhr"); + exports.BrowserXhr = browser_xhr_2.BrowserXhr; + var base_request_options_2 = require("angular2/src/http/base_request_options"); + exports.BaseRequestOptions = base_request_options_2.BaseRequestOptions; + exports.RequestOptions = base_request_options_2.RequestOptions; + var base_response_options_2 = require("angular2/src/http/base_response_options"); + exports.BaseResponseOptions = base_response_options_2.BaseResponseOptions; + exports.ResponseOptions = base_response_options_2.ResponseOptions; + var xhr_backend_2 = require("angular2/src/http/backends/xhr_backend"); + exports.XHRBackend = xhr_backend_2.XHRBackend; + exports.XHRConnection = xhr_backend_2.XHRConnection; + var jsonp_backend_2 = require("angular2/src/http/backends/jsonp_backend"); + exports.JSONPBackend = jsonp_backend_2.JSONPBackend; + exports.JSONPConnection = jsonp_backend_2.JSONPConnection; + var http_2 = require("angular2/src/http/http"); + exports.Http = http_2.Http; + exports.Jsonp = http_2.Jsonp; + var headers_1 = require("angular2/src/http/headers"); + exports.Headers = headers_1.Headers; + var enums_1 = require("angular2/src/http/enums"); + exports.ResponseTypes = enums_1.ResponseTypes; + exports.ReadyStates = enums_1.ReadyStates; + exports.RequestMethods = enums_1.RequestMethods; + var url_search_params_1 = require("angular2/src/http/url_search_params"); + exports.URLSearchParams = url_search_params_1.URLSearchParams; + exports.HTTP_BINDINGS = [core_1.bind(http_1.Http).toFactory(function(xhrBackend, requestOptions) { + return new http_1.Http(xhrBackend, requestOptions); + }, [xhr_backend_1.XHRBackend, base_request_options_1.RequestOptions]), browser_xhr_1.BrowserXhr, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), xhr_backend_1.XHRBackend]; + exports.JSONP_BINDINGS = [core_1.bind(http_1.Jsonp).toFactory(function(jsonpBackend, requestOptions) { + return new http_1.Jsonp(jsonpBackend, requestOptions); + }, [jsonp_backend_1.JSONPBackend, base_request_options_1.RequestOptions]), browser_jsonp_1.BrowserJsonp, core_1.bind(base_request_options_1.RequestOptions).toClass(base_request_options_1.BaseRequestOptions), core_1.bind(base_response_options_1.ResponseOptions).toClass(base_response_options_1.BaseResponseOptions), jsonp_backend_1.JSONPBackend]; + global.define = __define; + return module.exports; +}); + +}); +//# sourceMappingURLDisabled=http.sfx.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/router.dev.js b/2.0.0-snapshot/router.dev.js new file mode 100644 index 0000000000..9981e0acfe --- /dev/null +++ b/2.0.0-snapshot/router.dev.js @@ -0,0 +1,2281 @@ +"format register"; +System.register("angular2/src/router/instruction", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var RouteParams = (function() { + function RouteParams(params) { + this.params = params; + } + RouteParams.prototype.get = function(param) { + return lang_1.normalizeBlank(collection_1.StringMapWrapper.get(this.params, param)); + }; + return RouteParams; + })(); + exports.RouteParams = RouteParams; + var Instruction = (function() { + function Instruction(component, child, auxInstruction) { + this.component = component; + this.child = child; + this.auxInstruction = auxInstruction; + } + Instruction.prototype.replaceChild = function(child) { + return new Instruction(this.component, child, this.auxInstruction); + }; + return Instruction; + })(); + exports.Instruction = Instruction; + var PrimaryInstruction = (function() { + function PrimaryInstruction(component, child, auxUrls) { + this.component = component; + this.child = child; + this.auxUrls = auxUrls; + } + return PrimaryInstruction; + })(); + exports.PrimaryInstruction = PrimaryInstruction; + function stringifyInstruction(instruction) { + var params = instruction.component.urlParams.length > 0 ? ('?' + instruction.component.urlParams.join('&')) : ''; + return instruction.component.urlPath + stringifyAux(instruction) + stringifyPrimary(instruction.child) + params; + } + exports.stringifyInstruction = stringifyInstruction; + function stringifyPrimary(instruction) { + if (lang_1.isBlank(instruction)) { + return ''; + } + var params = instruction.component.urlParams.length > 0 ? (';' + instruction.component.urlParams.join(';')) : ''; + return '/' + instruction.component.urlPath + params + stringifyAux(instruction) + stringifyPrimary(instruction.child); + } + function stringifyAux(instruction) { + var routes = []; + collection_1.StringMapWrapper.forEach(instruction.auxInstruction, function(auxInstruction, _) { + routes.push(stringifyPrimary(auxInstruction)); + }); + if (routes.length > 0) { + return '(' + routes.join('//') + ')'; + } + return ''; + } + var ComponentInstruction = (function() { + function ComponentInstruction(urlPath, urlParams, _recognizer, params) { + if (params === void 0) { + params = null; + } + this.urlPath = urlPath; + this.urlParams = urlParams; + this._recognizer = _recognizer; + this.params = params; + this.reuse = false; + } + Object.defineProperty(ComponentInstruction.prototype, "componentType", { + get: function() { + return this._recognizer.handler.componentType; + }, + enumerable: true, + configurable: true + }); + ComponentInstruction.prototype.resolveComponentType = function() { + return this._recognizer.handler.resolveComponentType(); + }; + Object.defineProperty(ComponentInstruction.prototype, "specificity", { + get: function() { + return this._recognizer.specificity; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentInstruction.prototype, "terminal", { + get: function() { + return this._recognizer.terminal; + }, + enumerable: true, + configurable: true + }); + ComponentInstruction.prototype.routeData = function() { + return this._recognizer.handler.data; + }; + return ComponentInstruction; + })(); + exports.ComponentInstruction = ComponentInstruction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/lifecycle_annotations_impl", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var RouteLifecycleHook = (function() { + function RouteLifecycleHook(name) { + this.name = name; + } + RouteLifecycleHook = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], RouteLifecycleHook); + return RouteLifecycleHook; + })(); + exports.RouteLifecycleHook = RouteLifecycleHook; + var CanActivate = (function() { + function CanActivate(fn) { + this.fn = fn; + } + CanActivate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Function])], CanActivate); + return CanActivate; + })(); + exports.CanActivate = CanActivate; + exports.canReuse = lang_1.CONST_EXPR(new RouteLifecycleHook("canReuse")); + exports.canDeactivate = lang_1.CONST_EXPR(new RouteLifecycleHook("canDeactivate")); + exports.onActivate = lang_1.CONST_EXPR(new RouteLifecycleHook("onActivate")); + exports.onReuse = lang_1.CONST_EXPR(new RouteLifecycleHook("onReuse")); + exports.onDeactivate = lang_1.CONST_EXPR(new RouteLifecycleHook("onDeactivate")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_data", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.ROUTE_DATA = lang_1.CONST_EXPR(new di_1.OpaqueToken('routeData')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/lifecycle_annotations", ["angular2/src/core/util/decorators", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/router/lifecycle_annotations_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + var lifecycle_annotations_impl_1 = require("angular2/src/router/lifecycle_annotations_impl"); + var lifecycle_annotations_impl_2 = require("angular2/src/router/lifecycle_annotations_impl"); + exports.canReuse = lifecycle_annotations_impl_2.canReuse; + exports.canDeactivate = lifecycle_annotations_impl_2.canDeactivate; + exports.onActivate = lifecycle_annotations_impl_2.onActivate; + exports.onReuse = lifecycle_annotations_impl_2.onReuse; + exports.onDeactivate = lifecycle_annotations_impl_2.onDeactivate; + exports.CanActivate = decorators_1.makeDecorator(lifecycle_annotations_impl_1.CanActivate); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/location_strategy", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var LocationStrategy = (function() { + function LocationStrategy() {} + LocationStrategy.prototype.path = function() { + throw _abstract(); + }; + LocationStrategy.prototype.pushState = function(ctx, title, url) { + throw _abstract(); + }; + LocationStrategy.prototype.forward = function() { + throw _abstract(); + }; + LocationStrategy.prototype.back = function() { + throw _abstract(); + }; + LocationStrategy.prototype.onPopState = function(fn) { + throw _abstract(); + }; + LocationStrategy.prototype.getBaseHref = function() { + throw _abstract(); + }; + return LocationStrategy; + })(); + exports.LocationStrategy = LocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/url_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var Url = (function() { + function Url(path, child, auxiliary, params) { + if (child === void 0) { + child = null; + } + if (auxiliary === void 0) { + auxiliary = lang_1.CONST_EXPR([]); + } + if (params === void 0) { + params = null; + } + this.path = path; + this.child = child; + this.auxiliary = auxiliary; + this.params = params; + } + Url.prototype.toString = function() { + return this.path + this._matrixParamsToString() + this._auxToString() + this._childString(); + }; + Url.prototype.segmentToString = function() { + return this.path + this._matrixParamsToString(); + }; + Url.prototype._auxToString = function() { + return this.auxiliary.length > 0 ? ('(' + this.auxiliary.map(function(sibling) { + return sibling.toString(); + }).join('//') + ')') : ''; + }; + Url.prototype._matrixParamsToString = function() { + if (lang_1.isBlank(this.params)) { + return ''; + } + return ';' + serializeParams(this.params).join(';'); + }; + Url.prototype._childString = function() { + return lang_1.isPresent(this.child) ? ('/' + this.child.toString()) : ''; + }; + return Url; + })(); + exports.Url = Url; + var RootUrl = (function(_super) { + __extends(RootUrl, _super); + function RootUrl(path, child, auxiliary, params) { + if (child === void 0) { + child = null; + } + if (auxiliary === void 0) { + auxiliary = lang_1.CONST_EXPR([]); + } + if (params === void 0) { + params = null; + } + _super.call(this, path, child, auxiliary, params); + } + RootUrl.prototype.toString = function() { + return this.path + this._auxToString() + this._childString() + this._queryParamsToString(); + }; + RootUrl.prototype.segmentToString = function() { + return this.path + this._queryParamsToString(); + }; + RootUrl.prototype._queryParamsToString = function() { + if (lang_1.isBlank(this.params)) { + return ''; + } + return '?' + serializeParams(this.params).join('&'); + }; + return RootUrl; + })(Url); + exports.RootUrl = RootUrl; + function pathSegmentsToUrl(pathSegments) { + var url = new Url(pathSegments[pathSegments.length - 1]); + for (var i = pathSegments.length - 2; i >= 0; i -= 1) { + url = new Url(pathSegments[i], url); + } + return url; + } + exports.pathSegmentsToUrl = pathSegmentsToUrl; + var SEGMENT_RE = lang_1.RegExpWrapper.create('^[^\\/\\(\\)\\?;=&]+'); + function matchUrlSegment(str) { + var match = lang_1.RegExpWrapper.firstMatch(SEGMENT_RE, str); + return lang_1.isPresent(match) ? match[0] : null; + } + var UrlParser = (function() { + function UrlParser() {} + UrlParser.prototype.peekStartsWith = function(str) { + return lang_1.StringWrapper.startsWith(this._remaining, str); + }; + UrlParser.prototype.capture = function(str) { + if (!lang_1.StringWrapper.startsWith(this._remaining, str)) { + throw new exceptions_1.BaseException("Expected \"" + str + "\"."); + } + this._remaining = this._remaining.substring(str.length); + }; + UrlParser.prototype.parse = function(url) { + this._remaining = url; + if (url == '' || url == '/') { + return new Url(''); + } + return this.parseRoot(); + }; + UrlParser.prototype.parseRoot = function() { + if (this.peekStartsWith('/')) { + this.capture('/'); + } + var path = matchUrlSegment(this._remaining); + this.capture(path); + var aux = []; + if (this.peekStartsWith('(')) { + aux = this.parseAuxiliaryRoutes(); + } + if (this.peekStartsWith(';')) { + this.parseMatrixParams(); + } + var child = null; + if (this.peekStartsWith('/') && !this.peekStartsWith('//')) { + this.capture('/'); + child = this.parseSegment(); + } + var queryParams = null; + if (this.peekStartsWith('?')) { + queryParams = this.parseQueryParams(); + } + return new RootUrl(path, child, aux, queryParams); + }; + UrlParser.prototype.parseSegment = function() { + if (this._remaining.length == 0) { + return null; + } + if (this.peekStartsWith('/')) { + this.capture('/'); + } + var path = matchUrlSegment(this._remaining); + this.capture(path); + var matrixParams = null; + if (this.peekStartsWith(';')) { + matrixParams = this.parseMatrixParams(); + } + var aux = []; + if (this.peekStartsWith('(')) { + aux = this.parseAuxiliaryRoutes(); + } + var child = null; + if (this.peekStartsWith('/') && !this.peekStartsWith('//')) { + this.capture('/'); + child = this.parseSegment(); + } + return new Url(path, child, aux, matrixParams); + }; + UrlParser.prototype.parseQueryParams = function() { + var params = {}; + this.capture('?'); + this.parseParam(params); + while (this._remaining.length > 0 && this.peekStartsWith('&')) { + this.capture('&'); + this.parseParam(params); + } + return params; + }; + UrlParser.prototype.parseMatrixParams = function() { + var params = {}; + while (this._remaining.length > 0 && this.peekStartsWith(';')) { + this.capture(';'); + this.parseParam(params); + } + return params; + }; + UrlParser.prototype.parseParam = function(params) { + var key = matchUrlSegment(this._remaining); + if (lang_1.isBlank(key)) { + return ; + } + this.capture(key); + var value = true; + if (this.peekStartsWith('=')) { + this.capture('='); + var valueMatch = matchUrlSegment(this._remaining); + if (lang_1.isPresent(valueMatch)) { + value = valueMatch; + this.capture(value); + } + } + params[key] = value; + }; + UrlParser.prototype.parseAuxiliaryRoutes = function() { + var routes = []; + this.capture('('); + while (!this.peekStartsWith(')') && this._remaining.length > 0) { + routes.push(this.parseSegment()); + if (this.peekStartsWith('//')) { + this.capture('//'); + } + } + this.capture(')'); + return routes; + }; + return UrlParser; + })(); + exports.UrlParser = UrlParser; + exports.parser = new UrlParser(); + function serializeParams(paramMap) { + var params = []; + if (lang_1.isPresent(paramMap)) { + collection_1.StringMapWrapper.forEach(paramMap, function(value, key) { + if (value == true) { + params.push(key); + } else { + params.push(key + '=' + value); + } + }); + } + return params; + } + exports.serializeParams = serializeParams; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_impl", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var RouteConfig = (function() { + function RouteConfig(configs) { + this.configs = configs; + } + RouteConfig = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Array])], RouteConfig); + return RouteConfig; + })(); + exports.RouteConfig = RouteConfig; + var Route = (function() { + function Route(_a) { + var path = _a.path, + component = _a.component, + as = _a.as, + data = _a.data; + this.path = path; + this.component = component; + this.as = as; + this.loader = null; + this.redirectTo = null; + this.data = data; + } + Route = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], Route); + return Route; + })(); + exports.Route = Route; + var AuxRoute = (function() { + function AuxRoute(_a) { + var path = _a.path, + component = _a.component, + as = _a.as; + this.data = null; + this.loader = null; + this.redirectTo = null; + this.path = path; + this.component = component; + this.as = as; + } + AuxRoute = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], AuxRoute); + return AuxRoute; + })(); + exports.AuxRoute = AuxRoute; + var AsyncRoute = (function() { + function AsyncRoute(_a) { + var path = _a.path, + loader = _a.loader, + as = _a.as, + data = _a.data; + this.path = path; + this.loader = loader; + this.as = as; + this.data = data; + } + AsyncRoute = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], AsyncRoute); + return AsyncRoute; + })(); + exports.AsyncRoute = AsyncRoute; + var Redirect = (function() { + function Redirect(_a) { + var path = _a.path, + redirectTo = _a.redirectTo; + this.as = null; + this.loader = null; + this.data = null; + this.path = path; + this.redirectTo = redirectTo; + } + Redirect = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], Redirect); + return Redirect; + })(); + exports.Redirect = Redirect; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/async_route_handler", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var AsyncRouteHandler = (function() { + function AsyncRouteHandler(_loader, data) { + this._loader = _loader; + this.data = data; + this._resolvedComponent = null; + } + AsyncRouteHandler.prototype.resolveComponentType = function() { + var _this = this; + if (lang_1.isPresent(this._resolvedComponent)) { + return this._resolvedComponent; + } + return this._resolvedComponent = this._loader().then(function(componentType) { + _this.componentType = componentType; + return componentType; + }); + }; + return AsyncRouteHandler; + })(); + exports.AsyncRouteHandler = AsyncRouteHandler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/sync_route_handler", ["angular2/src/core/facade/async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_1 = require("angular2/src/core/facade/async"); + var SyncRouteHandler = (function() { + function SyncRouteHandler(componentType, data) { + this.componentType = componentType; + this.data = data; + this._resolvedComponent = null; + this._resolvedComponent = async_1.PromiseWrapper.resolve(componentType); + } + SyncRouteHandler.prototype.resolveComponentType = function() { + return this._resolvedComponent; + }; + return SyncRouteHandler; + })(); + exports.SyncRouteHandler = SyncRouteHandler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_decorator", ["angular2/src/router/route_config_impl", "angular2/src/core/util/decorators", "angular2/src/router/route_config_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var decorators_1 = require("angular2/src/core/util/decorators"); + var route_config_impl_2 = require("angular2/src/router/route_config_impl"); + exports.Route = route_config_impl_2.Route; + exports.Redirect = route_config_impl_2.Redirect; + exports.AuxRoute = route_config_impl_2.AuxRoute; + exports.AsyncRoute = route_config_impl_2.AsyncRoute; + exports.RouteConfig = decorators_1.makeDecorator(route_config_impl_1.RouteConfig); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/hash_location_strategy", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/router/location_strategy"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var HashLocationStrategy = (function(_super) { + __extends(HashLocationStrategy, _super); + function HashLocationStrategy() { + _super.call(this); + this._location = dom_adapter_1.DOM.getLocation(); + this._history = dom_adapter_1.DOM.getHistory(); + } + HashLocationStrategy.prototype.onPopState = function(fn) { + dom_adapter_1.DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }; + HashLocationStrategy.prototype.getBaseHref = function() { + return ''; + }; + HashLocationStrategy.prototype.path = function() { + var path = this._location.hash; + return path.length > 0 ? path.substring(1) : path; + }; + HashLocationStrategy.prototype.pushState = function(state, title, url) { + this._history.pushState(state, title, '#' + url); + }; + HashLocationStrategy.prototype.forward = function() { + this._history.forward(); + }; + HashLocationStrategy.prototype.back = function() { + this._history.back(); + }; + HashLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HashLocationStrategy); + return HashLocationStrategy; + })(location_strategy_1.LocationStrategy); + exports.HashLocationStrategy = HashLocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/path_location_strategy", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/router/location_strategy"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var PathLocationStrategy = (function(_super) { + __extends(PathLocationStrategy, _super); + function PathLocationStrategy() { + _super.call(this); + this._location = dom_adapter_1.DOM.getLocation(); + this._history = dom_adapter_1.DOM.getHistory(); + this._baseHref = dom_adapter_1.DOM.getBaseHref(); + } + PathLocationStrategy.prototype.onPopState = function(fn) { + dom_adapter_1.DOM.getGlobalEventTarget('window').addEventListener('popstate', fn, false); + }; + PathLocationStrategy.prototype.getBaseHref = function() { + return this._baseHref; + }; + PathLocationStrategy.prototype.path = function() { + return this._location.pathname; + }; + PathLocationStrategy.prototype.pushState = function(state, title, url) { + this._history.pushState(state, title, url); + }; + PathLocationStrategy.prototype.forward = function() { + this._history.forward(); + }; + PathLocationStrategy.prototype.back = function() { + this._history.back(); + }; + PathLocationStrategy = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PathLocationStrategy); + return PathLocationStrategy; + })(location_strategy_1.LocationStrategy); + exports.PathLocationStrategy = PathLocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_definition", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/location", ["angular2/src/router/location_strategy", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_2 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + exports.APP_BASE_HREF = lang_1.CONST_EXPR(new di_1.OpaqueToken('appBaseHref')); + var Location = (function() { + function Location(platformStrategy, href) { + var _this = this; + this.platformStrategy = platformStrategy; + this._subject = new async_1.EventEmitter(); + var browserBaseHref = lang_1.isPresent(href) ? href : this.platformStrategy.getBaseHref(); + if (lang_2.isBlank(browserBaseHref)) { + throw new exceptions_1.BaseException("No base href set. Either provide a binding to \"appBaseHrefToken\" or add a base element."); + } + this._baseHref = stripTrailingSlash(stripIndexHtml(browserBaseHref)); + this.platformStrategy.onPopState(function(_) { + async_1.ObservableWrapper.callNext(_this._subject, { + 'url': _this.path(), + 'pop': true + }); + }); + } + Location.prototype.path = function() { + return this.normalize(this.platformStrategy.path()); + }; + Location.prototype.normalize = function(url) { + return stripTrailingSlash(_stripBaseHref(this._baseHref, stripIndexHtml(url))); + }; + Location.prototype.normalizeAbsolutely = function(url) { + if (!url.startsWith('/')) { + url = '/' + url; + } + return stripTrailingSlash(_addBaseHref(this._baseHref, url)); + }; + Location.prototype.go = function(url) { + var finalUrl = this.normalizeAbsolutely(url); + this.platformStrategy.pushState(null, '', finalUrl); + }; + Location.prototype.forward = function() { + this.platformStrategy.forward(); + }; + Location.prototype.back = function() { + this.platformStrategy.back(); + }; + Location.prototype.subscribe = function(onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + async_1.ObservableWrapper.subscribe(this._subject, onNext, onThrow, onReturn); + }; + Location = __decorate([di_1.Injectable(), __param(1, di_1.Optional()), __param(1, di_1.Inject(exports.APP_BASE_HREF)), __metadata('design:paramtypes', [location_strategy_1.LocationStrategy, String])], Location); + return Location; + })(); + exports.Location = Location; + function _stripBaseHref(baseHref, url) { + if (baseHref.length > 0 && url.startsWith(baseHref)) { + return url.substring(baseHref.length); + } + return url; + } + function _addBaseHref(baseHref, url) { + if (!url.startsWith(baseHref)) { + return baseHref + url; + } + return url; + } + function stripIndexHtml(url) { + if (/\/index.html$/g.test(url)) { + return url.substring(0, url.length - 11); + } + return url; + } + function stripTrailingSlash(url) { + if (/\/$/g.test(url)) { + url = url.substring(0, url.length - 1); + } + return url; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/path_recognizer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/router/url_parser", "angular2/src/router/instruction"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var instruction_1 = require("angular2/src/router/instruction"); + var TouchMap = (function() { + function TouchMap(map) { + var _this = this; + this.map = {}; + this.keys = {}; + if (lang_1.isPresent(map)) { + collection_1.StringMapWrapper.forEach(map, function(value, key) { + _this.map[key] = lang_1.isPresent(value) ? value.toString() : null; + _this.keys[key] = true; + }); + } + } + TouchMap.prototype.get = function(key) { + collection_1.StringMapWrapper.delete(this.keys, key); + return this.map[key]; + }; + TouchMap.prototype.getUnused = function() { + var _this = this; + var unused = collection_1.StringMapWrapper.create(); + var keys = collection_1.StringMapWrapper.keys(this.keys); + collection_1.ListWrapper.forEach(keys, function(key) { + unused[key] = collection_1.StringMapWrapper.get(_this.map, key); + }); + return unused; + }; + return TouchMap; + })(); + function normalizeString(obj) { + if (lang_1.isBlank(obj)) { + return null; + } else { + return obj.toString(); + } + } + var ContinuationSegment = (function() { + function ContinuationSegment() { + this.name = ''; + } + ContinuationSegment.prototype.generate = function(params) { + return ''; + }; + ContinuationSegment.prototype.match = function(path) { + return true; + }; + return ContinuationSegment; + })(); + var StaticSegment = (function() { + function StaticSegment(path) { + this.path = path; + this.name = ''; + } + StaticSegment.prototype.match = function(path) { + return path == this.path; + }; + StaticSegment.prototype.generate = function(params) { + return this.path; + }; + return StaticSegment; + })(); + var DynamicSegment = (function() { + function DynamicSegment(name) { + this.name = name; + } + DynamicSegment.prototype.match = function(path) { + return path.length > 0; + }; + DynamicSegment.prototype.generate = function(params) { + if (!collection_1.StringMapWrapper.contains(params.map, this.name)) { + throw new exceptions_1.BaseException("Route generator for '" + this.name + "' was not included in parameters passed."); + } + return normalizeString(params.get(this.name)); + }; + return DynamicSegment; + })(); + var StarSegment = (function() { + function StarSegment(name) { + this.name = name; + } + StarSegment.prototype.match = function(path) { + return true; + }; + StarSegment.prototype.generate = function(params) { + return normalizeString(params.get(this.name)); + }; + return StarSegment; + })(); + var paramMatcher = /^:([^\/]+)$/g; + var wildcardMatcher = /^\*([^\/]+)$/g; + function parsePathString(route) { + if (lang_1.StringWrapper.startsWith(route, "/")) { + route = lang_1.StringWrapper.substring(route, 1); + } + var segments = splitBySlash(route); + var results = []; + var specificity = 0; + if (segments.length > 98) { + throw new exceptions_1.BaseException("'" + route + "' has more than the maximum supported number of segments."); + } + var limit = segments.length - 1; + for (var i = 0; i <= limit; i++) { + var segment = segments[i], + match; + if (lang_1.isPresent(match = lang_1.RegExpWrapper.firstMatch(paramMatcher, segment))) { + results.push(new DynamicSegment(match[1])); + specificity += (100 - i); + } else if (lang_1.isPresent(match = lang_1.RegExpWrapper.firstMatch(wildcardMatcher, segment))) { + results.push(new StarSegment(match[1])); + } else if (segment == '...') { + if (i < limit) { + throw new exceptions_1.BaseException("Unexpected \"...\" before the end of the path for \"" + route + "\"."); + } + results.push(new ContinuationSegment()); + } else { + results.push(new StaticSegment(segment)); + specificity += 100 * (100 - i); + } + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'segments', results); + collection_1.StringMapWrapper.set(result, 'specificity', specificity); + return result; + } + function pathDslHash(segments) { + return segments.map(function(segment) { + if (segment instanceof StarSegment) { + return '*'; + } else if (segment instanceof ContinuationSegment) { + return '...'; + } else if (segment instanceof DynamicSegment) { + return ':'; + } else if (segment instanceof StaticSegment) { + return segment.path; + } + }).join('/'); + } + function splitBySlash(url) { + return url.split('/'); + } + var RESERVED_CHARS = lang_1.RegExpWrapper.create('//|\\(|\\)|;|\\?|='); + function assertPath(path) { + if (lang_1.StringWrapper.contains(path, '#')) { + throw new exceptions_1.BaseException("Path \"" + path + "\" should not include \"#\". Use \"HashLocationStrategy\" instead."); + } + var illegalCharacter = lang_1.RegExpWrapper.firstMatch(RESERVED_CHARS, path); + if (lang_1.isPresent(illegalCharacter)) { + throw new exceptions_1.BaseException("Path \"" + path + "\" contains \"" + illegalCharacter[0] + "\" which is not allowed in a route config."); + } + } + var PathMatch = (function() { + function PathMatch(instruction, remaining, remainingAux) { + this.instruction = instruction; + this.remaining = remaining; + this.remainingAux = remainingAux; + } + return PathMatch; + })(); + exports.PathMatch = PathMatch; + var PathRecognizer = (function() { + function PathRecognizer(path, handler) { + this.path = path; + this.handler = handler; + this.terminal = true; + this._cache = new collection_1.Map(); + assertPath(path); + var parsed = parsePathString(path); + this._segments = parsed['segments']; + this.specificity = parsed['specificity']; + this.hash = pathDslHash(this._segments); + var lastSegment = this._segments[this._segments.length - 1]; + this.terminal = !(lastSegment instanceof ContinuationSegment); + } + PathRecognizer.prototype.recognize = function(beginningSegment) { + var nextSegment = beginningSegment; + var currentSegment; + var positionalParams = {}; + var captured = []; + for (var i = 0; i < this._segments.length; i += 1) { + var segment = this._segments[i]; + currentSegment = nextSegment; + if (segment instanceof ContinuationSegment) { + break; + } + if (lang_1.isPresent(currentSegment)) { + captured.push(currentSegment.path); + if (segment instanceof StarSegment) { + positionalParams[segment.name] = currentSegment.toString(); + nextSegment = null; + break; + } + if (segment instanceof DynamicSegment) { + positionalParams[segment.name] = currentSegment.path; + } else if (!segment.match(currentSegment.path)) { + return null; + } + nextSegment = currentSegment.child; + } else if (!segment.match('')) { + return null; + } + } + if (this.terminal && lang_1.isPresent(nextSegment)) { + return null; + } + var urlPath = captured.join('/'); + var auxiliary; + var instruction; + var urlParams; + var allParams; + if (lang_1.isPresent(currentSegment)) { + var paramsSegment = beginningSegment instanceof url_parser_1.RootUrl ? beginningSegment : currentSegment; + allParams = lang_1.isPresent(paramsSegment.params) ? collection_1.StringMapWrapper.merge(paramsSegment.params, positionalParams) : positionalParams; + urlParams = url_parser_1.serializeParams(paramsSegment.params); + auxiliary = currentSegment.auxiliary; + } else { + allParams = positionalParams; + auxiliary = []; + urlParams = []; + } + instruction = this._getInstruction(urlPath, urlParams, this, allParams); + return new PathMatch(instruction, nextSegment, auxiliary); + }; + PathRecognizer.prototype.generate = function(params) { + var paramTokens = new TouchMap(params); + var path = []; + for (var i = 0; i < this._segments.length; i++) { + var segment = this._segments[i]; + if (!(segment instanceof ContinuationSegment)) { + path.push(segment.generate(paramTokens)); + } + } + var urlPath = path.join('/'); + var nonPositionalParams = paramTokens.getUnused(); + var urlParams = url_parser_1.serializeParams(nonPositionalParams); + return this._getInstruction(urlPath, urlParams, this, params); + }; + PathRecognizer.prototype._getInstruction = function(urlPath, urlParams, _recognizer, params) { + var hashKey = urlPath + '?' + urlParams.join('?'); + if (this._cache.has(hashKey)) { + return this._cache.get(hashKey); + } + var instruction = new instruction_1.ComponentInstruction(urlPath, urlParams, _recognizer, params); + this._cache.set(hashKey, instruction); + return instruction; + }; + return PathRecognizer; + })(); + exports.PathRecognizer = PathRecognizer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_config_nomalizer", ["angular2/src/router/route_config_decorator", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var route_config_decorator_1 = require("angular2/src/router/route_config_decorator"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + function normalizeRouteConfig(config) { + if (config instanceof route_config_decorator_1.Route || config instanceof route_config_decorator_1.Redirect || config instanceof route_config_decorator_1.AsyncRoute || config instanceof route_config_decorator_1.AuxRoute) { + return config; + } + if ((!config.component) == (!config.redirectTo)) { + throw new exceptions_1.BaseException("Route config should contain exactly one \"component\", \"loader\", or \"redirectTo\" property."); + } + if (config.component) { + if (typeof config.component == 'object') { + var componentDefinitionObject = config.component; + if (componentDefinitionObject.type == 'constructor') { + return new route_config_decorator_1.Route({ + path: config.path, + component: componentDefinitionObject.constructor, + as: config.as + }); + } else if (componentDefinitionObject.type == 'loader') { + return new route_config_decorator_1.AsyncRoute({ + path: config.path, + loader: componentDefinitionObject.loader, + as: config.as + }); + } else { + throw new exceptions_1.BaseException("Invalid component type \"" + componentDefinitionObject.type + "\". Valid types are \"constructor\" and \"loader\"."); + } + } + return new route_config_decorator_1.Route(config); + } + if (config.redirectTo) { + return new route_config_decorator_1.Redirect({ + path: config.path, + redirectTo: config.redirectTo + }); + } + return config; + } + exports.normalizeRouteConfig = normalizeRouteConfig; + function assertComponentExists(component, path) { + if (!lang_1.isType(component)) { + throw new exceptions_1.BaseException("Component for route \"" + path + "\" is not defined, or is not a class."); + } + } + exports.assertComponentExists = assertComponentExists; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/router/lifecycle_annotations_impl", "angular2/src/core/reflection/reflection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lifecycle_annotations_impl_1 = require("angular2/src/router/lifecycle_annotations_impl"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + function hasLifecycleHook(e, type) { + if (!(type instanceof lang_1.Type)) + return false; + return e.name in type.prototype; + } + exports.hasLifecycleHook = hasLifecycleHook; + function getCanActivateHook(type) { + var annotations = reflection_1.reflector.annotations(type); + for (var i = 0; i < annotations.length; i += 1) { + var annotation = annotations[i]; + if (annotation instanceof lifecycle_annotations_impl_1.CanActivate) { + return annotation.fn; + } + } + return null; + } + exports.getCanActivateHook = getCanActivateHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router_link", ["angular2/src/core/metadata", "angular2/src/router/router", "angular2/src/router/location", "angular2/src/router/instruction"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var router_1 = require("angular2/src/router/router"); + var location_1 = require("angular2/src/router/location"); + var instruction_1 = require("angular2/src/router/instruction"); + var RouterLink = (function() { + function RouterLink(_router, _location) { + this._router = _router; + this._location = _location; + } + Object.defineProperty(RouterLink.prototype, "isRouteActive", { + get: function() { + return this._router.isRouteActive(this._navigationInstruction); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RouterLink.prototype, "routeParams", { + set: function(changes) { + this._routeParams = changes; + this._navigationInstruction = this._router.generate(this._routeParams); + var navigationHref = '/' + instruction_1.stringifyInstruction(this._navigationInstruction); + this.visibleHref = this._location.normalizeAbsolutely(navigationHref); + }, + enumerable: true, + configurable: true + }); + RouterLink.prototype.onClick = function() { + this._router.navigateByInstruction(this._navigationInstruction); + return false; + }; + RouterLink = __decorate([metadata_1.Directive({ + selector: '[router-link]', + properties: ['routeParams: routerLink'], + host: { + '(click)': 'onClick()', + '[attr.href]': 'visibleHref', + '[class.router-link-active]': 'isRouteActive' + } + }), __metadata('design:paramtypes', [router_1.Router, location_1.Location])], RouterLink); + return RouterLink; + })(); + exports.RouterLink = RouterLink; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_recognizer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/router/path_recognizer", "angular2/src/router/route_config_impl", "angular2/src/router/async_route_handler", "angular2/src/router/sync_route_handler", "angular2/src/router/url_parser"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var path_recognizer_1 = require("angular2/src/router/path_recognizer"); + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var async_route_handler_1 = require("angular2/src/router/async_route_handler"); + var sync_route_handler_1 = require("angular2/src/router/sync_route_handler"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var RouteRecognizer = (function() { + function RouteRecognizer() { + this.names = new collection_1.Map(); + this.auxRoutes = new collection_1.Map(); + this.matchers = []; + this.redirects = []; + } + RouteRecognizer.prototype.config = function(config) { + var handler; + if (lang_1.isPresent(config.as) && config.as[0].toUpperCase() != config.as[0]) { + var suggestedAlias = config.as[0].toUpperCase() + config.as.substring(1); + throw new exceptions_1.BaseException("Route '" + config.path + "' with alias '" + config.as + "' does not begin with an uppercase letter. Route aliases should be CamelCase like '" + suggestedAlias + "'."); + } + if (config instanceof route_config_impl_1.AuxRoute) { + handler = new sync_route_handler_1.SyncRouteHandler(config.component, config.data); + var path = lang_1.StringWrapper.startsWith(config.path, '/') ? config.path.substring(1) : config.path; + var recognizer = new path_recognizer_1.PathRecognizer(config.path, handler); + this.auxRoutes.set(path, recognizer); + return recognizer.terminal; + } + if (config instanceof route_config_impl_1.Redirect) { + this.redirects.push(new Redirector(config.path, config.redirectTo)); + return true; + } + if (config instanceof route_config_impl_1.Route) { + handler = new sync_route_handler_1.SyncRouteHandler(config.component, config.data); + } else if (config instanceof route_config_impl_1.AsyncRoute) { + handler = new async_route_handler_1.AsyncRouteHandler(config.loader, config.data); + } + var recognizer = new path_recognizer_1.PathRecognizer(config.path, handler); + this.matchers.forEach(function(matcher) { + if (recognizer.hash == matcher.hash) { + throw new exceptions_1.BaseException("Configuration '" + config.path + "' conflicts with existing route '" + matcher.path + "'"); + } + }); + this.matchers.push(recognizer); + if (lang_1.isPresent(config.as)) { + this.names.set(config.as, recognizer); + } + return recognizer.terminal; + }; + RouteRecognizer.prototype.recognize = function(urlParse) { + var solutions = []; + urlParse = this._redirect(urlParse); + this.matchers.forEach(function(pathRecognizer) { + var pathMatch = pathRecognizer.recognize(urlParse); + if (lang_1.isPresent(pathMatch)) { + solutions.push(pathMatch); + } + }); + return solutions; + }; + RouteRecognizer.prototype._redirect = function(urlParse) { + for (var i = 0; i < this.redirects.length; i += 1) { + var redirector = this.redirects[i]; + var redirectedUrl = redirector.redirect(urlParse); + if (lang_1.isPresent(redirectedUrl)) { + return redirectedUrl; + } + } + return urlParse; + }; + RouteRecognizer.prototype.recognizeAuxiliary = function(urlParse) { + var pathRecognizer = this.auxRoutes.get(urlParse.path); + if (lang_1.isBlank(pathRecognizer)) { + return null; + } + return pathRecognizer.recognize(urlParse); + }; + RouteRecognizer.prototype.hasRoute = function(name) { + return this.names.has(name); + }; + RouteRecognizer.prototype.generate = function(name, params) { + var pathRecognizer = this.names.get(name); + if (lang_1.isBlank(pathRecognizer)) { + return null; + } + return pathRecognizer.generate(params); + }; + return RouteRecognizer; + })(); + exports.RouteRecognizer = RouteRecognizer; + var Redirector = (function() { + function Redirector(path, redirectTo) { + this.segments = []; + this.toSegments = []; + if (lang_1.StringWrapper.startsWith(path, '/')) { + path = path.substring(1); + } + this.segments = path.split('/'); + if (lang_1.StringWrapper.startsWith(redirectTo, '/')) { + redirectTo = redirectTo.substring(1); + } + this.toSegments = redirectTo.split('/'); + } + Redirector.prototype.redirect = function(urlParse) { + for (var i = 0; i < this.segments.length; i += 1) { + if (lang_1.isBlank(urlParse)) { + return null; + } + var segment = this.segments[i]; + if (segment != urlParse.path) { + return null; + } + urlParse = urlParse.child; + } + for (var i = this.toSegments.length - 1; i >= 0; i -= 1) { + var segment = this.toSegments[i]; + urlParse = new url_parser_1.Url(segment, urlParse); + } + return urlParse; + }; + return Redirector; + })(); + exports.Redirector = Redirector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/route_registry", ["angular2/src/router/route_recognizer", "angular2/src/router/instruction", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/router/route_config_impl", "angular2/src/core/reflection/reflection", "angular2/src/core/di", "angular2/src/router/route_config_nomalizer", "angular2/src/router/url_parser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var route_recognizer_1 = require("angular2/src/router/route_recognizer"); + var instruction_1 = require("angular2/src/router/instruction"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var route_config_impl_1 = require("angular2/src/router/route_config_impl"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_1 = require("angular2/src/core/di"); + var route_config_nomalizer_1 = require("angular2/src/router/route_config_nomalizer"); + var url_parser_1 = require("angular2/src/router/url_parser"); + var _resolveToNull = async_1.PromiseWrapper.resolve(null); + var RouteRegistry = (function() { + function RouteRegistry() { + this._rules = new collection_1.Map(); + } + RouteRegistry.prototype.config = function(parentComponent, config) { + config = route_config_nomalizer_1.normalizeRouteConfig(config); + if (config instanceof route_config_impl_1.Route) { + route_config_nomalizer_1.assertComponentExists(config.component, config.path); + } else if (config instanceof route_config_impl_1.AuxRoute) { + route_config_nomalizer_1.assertComponentExists(config.component, config.path); + } + var recognizer = this._rules.get(parentComponent); + if (lang_1.isBlank(recognizer)) { + recognizer = new route_recognizer_1.RouteRecognizer(); + this._rules.set(parentComponent, recognizer); + } + var terminal = recognizer.config(config); + if (config instanceof route_config_impl_1.Route) { + if (terminal) { + assertTerminalComponent(config.component, config.path); + } else { + this.configFromComponent(config.component); + } + } + }; + RouteRegistry.prototype.configFromComponent = function(component) { + var _this = this; + if (!lang_1.isType(component)) { + return ; + } + if (this._rules.has(component)) { + return ; + } + var annotations = reflection_1.reflector.annotations(component); + if (lang_1.isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof route_config_impl_1.RouteConfig) { + collection_1.ListWrapper.forEach(annotation.configs, function(config) { + return _this.config(component, config); + }); + } + } + } + }; + RouteRegistry.prototype.recognize = function(url, parentComponent) { + var parsedUrl = url_parser_1.parser.parse(url); + return this._recognize(parsedUrl, parentComponent); + }; + RouteRegistry.prototype._recognize = function(parsedUrl, parentComponent) { + var _this = this; + return this._recognizePrimaryRoute(parsedUrl, parentComponent).then(function(instruction) { + return _this._completeAuxiliaryRouteMatches(instruction, parentComponent); + }); + }; + RouteRegistry.prototype._recognizePrimaryRoute = function(parsedUrl, parentComponent) { + var _this = this; + var componentRecognizer = this._rules.get(parentComponent); + if (lang_1.isBlank(componentRecognizer)) { + return _resolveToNull; + } + var possibleMatches = componentRecognizer.recognize(parsedUrl); + var matchPromises = collection_1.ListWrapper.map(possibleMatches, function(candidate) { + return _this._completePrimaryRouteMatch(candidate); + }); + return async_1.PromiseWrapper.all(matchPromises).then(mostSpecific); + }; + RouteRegistry.prototype._completePrimaryRouteMatch = function(partialMatch) { + var _this = this; + var instruction = partialMatch.instruction; + return instruction.resolveComponentType().then(function(componentType) { + _this.configFromComponent(componentType); + if (instruction.terminal) { + return new instruction_1.PrimaryInstruction(instruction, null, partialMatch.remainingAux); + } + return _this._recognizePrimaryRoute(partialMatch.remaining, componentType).then(function(childInstruction) { + if (lang_1.isBlank(childInstruction)) { + return null; + } else { + return new instruction_1.PrimaryInstruction(instruction, childInstruction, partialMatch.remainingAux); + } + }); + }); + }; + RouteRegistry.prototype._completeAuxiliaryRouteMatches = function(instruction, parentComponent) { + var _this = this; + if (lang_1.isBlank(instruction)) { + return _resolveToNull; + } + var componentRecognizer = this._rules.get(parentComponent); + var auxInstructions = {}; + var promises = instruction.auxUrls.map(function(auxSegment) { + var match = componentRecognizer.recognizeAuxiliary(auxSegment); + if (lang_1.isBlank(match)) { + return _resolveToNull; + } + return _this._completePrimaryRouteMatch(match).then(function(auxInstruction) { + if (lang_1.isPresent(auxInstruction)) { + return _this._completeAuxiliaryRouteMatches(auxInstruction, parentComponent).then(function(finishedAuxRoute) { + auxInstructions[auxSegment.path] = finishedAuxRoute; + }); + } + }); + }); + return async_1.PromiseWrapper.all(promises).then(function(_) { + if (lang_1.isBlank(instruction.child)) { + return new instruction_1.Instruction(instruction.component, null, auxInstructions); + } + return _this._completeAuxiliaryRouteMatches(instruction.child, instruction.component.componentType).then(function(completeChild) { + return new instruction_1.Instruction(instruction.component, completeChild, auxInstructions); + }); + }); + }; + RouteRegistry.prototype.generate = function(linkParams, parentComponent) { + var segments = []; + var componentCursor = parentComponent; + var lastInstructionIsTerminal = false; + for (var i = 0; i < linkParams.length; i += 1) { + var segment = linkParams[i]; + if (lang_1.isBlank(componentCursor)) { + throw new exceptions_1.BaseException("Could not find route named \"" + segment + "\"."); + } + if (!lang_1.isString(segment)) { + throw new exceptions_1.BaseException("Unexpected segment \"" + segment + "\" in link DSL. Expected a string."); + } else if (segment == '' || segment == '.' || segment == '..') { + throw new exceptions_1.BaseException("\"" + segment + "/\" is only allowed at the beginning of a link DSL."); + } + var params = {}; + if (i + 1 < linkParams.length) { + var nextSegment = linkParams[i + 1]; + if (lang_1.isStringMap(nextSegment)) { + params = nextSegment; + i += 1; + } + } + var componentRecognizer = this._rules.get(componentCursor); + if (lang_1.isBlank(componentRecognizer)) { + throw new exceptions_1.BaseException("Component \"" + lang_1.getTypeNameForDebugging(componentCursor) + "\" has no route config."); + } + var response = componentRecognizer.generate(segment, params); + if (lang_1.isBlank(response)) { + throw new exceptions_1.BaseException("Component \"" + lang_1.getTypeNameForDebugging(componentCursor) + "\" has no route named \"" + segment + "\"."); + } + segments.push(response); + componentCursor = response.componentType; + lastInstructionIsTerminal = response.terminal; + } + var instruction = null; + if (!lastInstructionIsTerminal) { + instruction = this._generateRedirects(componentCursor); + if (lang_1.isPresent(instruction)) { + var lastInstruction = instruction; + while (lang_1.isPresent(lastInstruction.child)) { + lastInstruction = lastInstruction.child; + } + lastInstructionIsTerminal = lastInstruction.component.terminal; + } + if (lang_1.isPresent(componentCursor) && !lastInstructionIsTerminal) { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" does not resolve to a terminal or async instruction."); + } + } + while (segments.length > 0) { + instruction = new instruction_1.Instruction(segments.pop(), instruction, {}); + } + return instruction; + }; + RouteRegistry.prototype._generateRedirects = function(componentCursor) { + if (lang_1.isBlank(componentCursor)) { + return null; + } + var componentRecognizer = this._rules.get(componentCursor); + if (lang_1.isBlank(componentRecognizer)) { + return null; + } + for (var i = 0; i < componentRecognizer.redirects.length; i += 1) { + var redirect = componentRecognizer.redirects[i]; + if (redirect.segments.length == 1 && redirect.segments[0] == '') { + var toSegments = url_parser_1.pathSegmentsToUrl(redirect.toSegments); + var matches = componentRecognizer.recognize(toSegments); + var primaryInstruction = collection_1.ListWrapper.maximum(matches, function(match) { + return match.instruction.specificity; + }); + if (lang_1.isPresent(primaryInstruction)) { + var child = this._generateRedirects(primaryInstruction.instruction.componentType); + return new instruction_1.Instruction(primaryInstruction.instruction, child, {}); + } + return null; + } + } + return null; + }; + RouteRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], RouteRegistry); + return RouteRegistry; + })(); + exports.RouteRegistry = RouteRegistry; + function mostSpecific(instructions) { + return collection_1.ListWrapper.maximum(instructions, function(instruction) { + return instruction.component.specificity; + }); + } + function assertTerminalComponent(component, path) { + if (!lang_1.isType(component)) { + return ; + } + var annotations = reflection_1.reflector.annotations(component); + if (lang_1.isPresent(annotations)) { + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof route_config_impl_1.RouteConfig) { + throw new exceptions_1.BaseException("Child routes are not allowed for \"" + path + "\". Use \"...\" on the parent's route path."); + } + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/router/instruction", "angular2/src/router/route_lifecycle_reflector"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var instruction_1 = require("angular2/src/router/instruction"); + var route_lifecycle_reflector_1 = require("angular2/src/router/route_lifecycle_reflector"); + var _resolveToTrue = async_1.PromiseWrapper.resolve(true); + var _resolveToFalse = async_1.PromiseWrapper.resolve(false); + var Router = (function() { + function Router(registry, parent, hostComponent) { + this.registry = registry; + this.parent = parent; + this.hostComponent = hostComponent; + this.navigating = false; + this._currentInstruction = null; + this._currentNavigation = _resolveToTrue; + this._outlet = null; + this._auxRouters = new collection_1.Map(); + this._subject = new async_1.EventEmitter(); + } + Router.prototype.childRouter = function(hostComponent) { + return this._childRouter = new ChildRouter(this, hostComponent); + }; + Router.prototype.auxRouter = function(hostComponent) { + return new ChildRouter(this, hostComponent); + }; + Router.prototype.registerPrimaryOutlet = function(outlet) { + if (lang_1.isPresent(outlet.name)) { + throw new exceptions_1.BaseException("registerAuxOutlet expects to be called with an unnamed outlet."); + } + this._outlet = outlet; + if (lang_1.isPresent(this._currentInstruction)) { + return this.commit(this._currentInstruction, false); + } + return _resolveToTrue; + }; + Router.prototype.registerAuxOutlet = function(outlet) { + var outletName = outlet.name; + if (lang_1.isBlank(outletName)) { + throw new exceptions_1.BaseException("registerAuxOutlet expects to be called with an outlet with a name."); + } + var router = this.auxRouter(this.hostComponent); + this._auxRouters.set(outletName, router); + router._outlet = outlet; + var auxInstruction; + if (lang_1.isPresent(this._currentInstruction) && lang_1.isPresent(auxInstruction = this._currentInstruction.auxInstruction[outletName])) { + return router.commit(auxInstruction); + } + return _resolveToTrue; + }; + Router.prototype.isRouteActive = function(instruction) { + var router = this; + while (lang_1.isPresent(router.parent) && lang_1.isPresent(instruction.child)) { + router = router.parent; + instruction = instruction.child; + } + return lang_1.isPresent(this._currentInstruction) && this._currentInstruction.component == instruction.component; + }; + Router.prototype.config = function(definitions) { + var _this = this; + definitions.forEach(function(routeDefinition) { + _this.registry.config(_this.hostComponent, routeDefinition); + }); + return this.renavigate(); + }; + Router.prototype.navigate = function(linkParams) { + var instruction = this.generate(linkParams); + return this.navigateByInstruction(instruction, false); + }; + Router.prototype.navigateByUrl = function(url, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this._currentNavigation = this._currentNavigation.then(function(_) { + _this.lastNavigationAttempt = url; + _this._startNavigating(); + return _this._afterPromiseFinishNavigating(_this.recognize(url).then(function(instruction) { + if (lang_1.isBlank(instruction)) { + return false; + } + return _this._navigate(instruction, _skipLocationChange); + })); + }); + }; + Router.prototype.navigateByInstruction = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + if (lang_1.isBlank(instruction)) { + return _resolveToFalse; + } + return this._currentNavigation = this._currentNavigation.then(function(_) { + _this._startNavigating(); + return _this._afterPromiseFinishNavigating(_this._navigate(instruction, _skipLocationChange)); + }); + }; + Router.prototype._navigate = function(instruction, _skipLocationChange) { + var _this = this; + return this._settleInstruction(instruction).then(function(_) { + return _this._canReuse(instruction); + }).then(function(_) { + return _this._canActivate(instruction); + }).then(function(result) { + if (!result) { + return false; + } + return _this._canDeactivate(instruction).then(function(result) { + if (result) { + return _this.commit(instruction, _skipLocationChange).then(function(_) { + _this._emitNavigationFinish(instruction_1.stringifyInstruction(instruction)); + return true; + }); + } + }); + }); + }; + Router.prototype._settleInstruction = function(instruction) { + var _this = this; + var unsettledInstructions = []; + if (lang_1.isBlank(instruction.component.componentType)) { + unsettledInstructions.push(instruction.component.resolveComponentType().then(function(type) { + _this.registry.configFromComponent(type); + })); + } + if (lang_1.isPresent(instruction.child)) { + unsettledInstructions.push(this._settleInstruction(instruction.child)); + } + collection_1.StringMapWrapper.forEach(instruction.auxInstruction, function(instruction, _) { + unsettledInstructions.push(_this._settleInstruction(instruction)); + }); + return async_1.PromiseWrapper.all(unsettledInstructions); + }; + Router.prototype._emitNavigationFinish = function(url) { + async_1.ObservableWrapper.callNext(this._subject, url); + }; + Router.prototype._afterPromiseFinishNavigating = function(promise) { + var _this = this; + return async_1.PromiseWrapper.catchError(promise.then(function(_) { + return _this._finishNavigating(); + }), function(err) { + _this._finishNavigating(); + throw err; + }); + }; + Router.prototype._canReuse = function(instruction) { + var _this = this; + if (lang_1.isBlank(this._outlet)) { + return _resolveToFalse; + } + return this._outlet.canReuse(instruction.component).then(function(result) { + instruction.component.reuse = result; + if (result && lang_1.isPresent(_this._childRouter) && lang_1.isPresent(instruction.child)) { + return _this._childRouter._canReuse(instruction.child); + } + }); + }; + Router.prototype._canActivate = function(nextInstruction) { + return canActivateOne(nextInstruction, this._currentInstruction); + }; + Router.prototype._canDeactivate = function(instruction) { + var _this = this; + if (lang_1.isBlank(this._outlet)) { + return _resolveToTrue; + } + var next; + var childInstruction = null; + var reuse = false; + var componentInstruction = null; + if (lang_1.isPresent(instruction)) { + childInstruction = instruction.child; + componentInstruction = instruction.component; + reuse = instruction.component.reuse; + } + if (reuse) { + next = _resolveToTrue; + } else { + next = this._outlet.canDeactivate(componentInstruction); + } + return next.then(function(result) { + if (result == false) { + return false; + } + if (lang_1.isPresent(_this._childRouter)) { + return _this._childRouter._canDeactivate(childInstruction); + } + return true; + }); + }; + Router.prototype.commit = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + this._currentInstruction = instruction; + var next = _resolveToTrue; + if (lang_1.isPresent(this._outlet)) { + var componentInstruction = instruction.component; + if (componentInstruction.reuse) { + next = this._outlet.reuse(componentInstruction); + } else { + next = this.deactivate(instruction).then(function(_) { + return _this._outlet.activate(componentInstruction); + }); + } + if (lang_1.isPresent(instruction.child)) { + next = next.then(function(_) { + if (lang_1.isPresent(_this._childRouter)) { + return _this._childRouter.commit(instruction.child); + } + }); + } + } + var promises = []; + collection_1.MapWrapper.forEach(this._auxRouters, function(router, name) { + promises.push(router.commit(instruction.auxInstruction[name])); + }); + return next.then(function(_) { + return async_1.PromiseWrapper.all(promises); + }); + }; + Router.prototype._startNavigating = function() { + this.navigating = true; + }; + Router.prototype._finishNavigating = function() { + this.navigating = false; + }; + Router.prototype.subscribe = function(onNext) { + return async_1.ObservableWrapper.subscribe(this._subject, onNext); + }; + Router.prototype.deactivate = function(instruction) { + var _this = this; + var childInstruction = null; + var componentInstruction = null; + if (lang_1.isPresent(instruction)) { + childInstruction = instruction.child; + componentInstruction = instruction.component; + } + var next = _resolveToTrue; + if (lang_1.isPresent(this._childRouter)) { + next = this._childRouter.deactivate(childInstruction); + } + if (lang_1.isPresent(this._outlet)) { + next = next.then(function(_) { + return _this._outlet.deactivate(componentInstruction); + }); + } + return next; + }; + Router.prototype.recognize = function(url) { + return this.registry.recognize(url, this.hostComponent); + }; + Router.prototype.renavigate = function() { + if (lang_1.isBlank(this.lastNavigationAttempt)) { + return this._currentNavigation; + } + return this.navigateByUrl(this.lastNavigationAttempt); + }; + Router.prototype.generate = function(linkParams) { + var normalizedLinkParams = splitAndFlattenLinkParams(linkParams); + var first = collection_1.ListWrapper.first(normalizedLinkParams); + var rest = collection_1.ListWrapper.slice(normalizedLinkParams, 1); + var router = this; + if (first == '') { + while (lang_1.isPresent(router.parent)) { + router = router.parent; + } + } else if (first == '..') { + router = router.parent; + while (collection_1.ListWrapper.first(rest) == '..') { + rest = collection_1.ListWrapper.slice(rest, 1); + router = router.parent; + if (lang_1.isBlank(router)) { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" has too many \"../\" segments."); + } + } + } else if (first != '.') { + throw new exceptions_1.BaseException("Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" must start with \"/\", \"./\", or \"../\""); + } + if (rest[rest.length - 1] == '') { + collection_1.ListWrapper.removeLast(rest); + } + if (rest.length < 1) { + var msg = "Link \"" + collection_1.ListWrapper.toJSON(linkParams) + "\" must include a route name."; + throw new exceptions_1.BaseException(msg); + } + var url = []; + var parent = router.parent; + while (lang_1.isPresent(parent)) { + url.unshift(parent._currentInstruction); + parent = parent.parent; + } + var nextInstruction = this.registry.generate(rest, router.hostComponent); + while (url.length > 0) { + nextInstruction = url.pop().replaceChild(nextInstruction); + } + return nextInstruction; + }; + return Router; + })(); + exports.Router = Router; + var RootRouter = (function(_super) { + __extends(RootRouter, _super); + function RootRouter(registry, location, primaryComponent) { + var _this = this; + _super.call(this, registry, null, primaryComponent); + this._location = location; + this._location.subscribe(function(change) { + return _this.navigateByUrl(change['url'], lang_1.isPresent(change['pop'])); + }); + this.registry.configFromComponent(primaryComponent); + this.navigateByUrl(location.path()); + } + RootRouter.prototype.commit = function(instruction, _skipLocationChange) { + var _this = this; + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + var emitUrl = instruction_1.stringifyInstruction(instruction); + if (emitUrl.length > 0) { + emitUrl = '/' + emitUrl; + } + var promise = _super.prototype.commit.call(this, instruction); + if (!_skipLocationChange) { + promise = promise.then(function(_) { + _this._location.go(emitUrl); + }); + } + return promise; + }; + return RootRouter; + })(Router); + exports.RootRouter = RootRouter; + var ChildRouter = (function(_super) { + __extends(ChildRouter, _super); + function ChildRouter(parent, hostComponent) { + _super.call(this, parent.registry, parent, hostComponent); + this.parent = parent; + } + ChildRouter.prototype.navigateByUrl = function(url, _skipLocationChange) { + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this.parent.navigateByUrl(url, _skipLocationChange); + }; + ChildRouter.prototype.navigateByInstruction = function(instruction, _skipLocationChange) { + if (_skipLocationChange === void 0) { + _skipLocationChange = false; + } + return this.parent.navigateByInstruction(instruction, _skipLocationChange); + }; + return ChildRouter; + })(Router); + var SLASH = new RegExp('/'); + function splitAndFlattenLinkParams(linkParams) { + return collection_1.ListWrapper.reduce(linkParams, function(accumulation, item) { + if (lang_1.isString(item)) { + return accumulation.concat(lang_1.StringWrapper.split(item, SLASH)); + } + accumulation.push(item); + return accumulation; + }, []); + } + function canActivateOne(nextInstruction, prevInstruction) { + var next = _resolveToTrue; + if (lang_1.isPresent(nextInstruction.child)) { + next = canActivateOne(nextInstruction.child, lang_1.isPresent(prevInstruction) ? prevInstruction.child : null); + } + return next.then(function(result) { + if (result == false) { + return false; + } + if (nextInstruction.component.reuse) { + return true; + } + var hook = route_lifecycle_reflector_1.getCanActivateHook(nextInstruction.component.componentType); + if (lang_1.isPresent(hook)) { + return hook(nextInstruction.component, lang_1.isPresent(prevInstruction) ? prevInstruction.component : null); + } + return true; + }); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/router_outlet", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/router/router", "angular2/src/router/instruction", "angular2/src/router/route_data", "angular2/src/router/lifecycle_annotations", "angular2/src/router/route_lifecycle_reflector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var routerMod = require("angular2/src/router/router"); + var instruction_1 = require("angular2/src/router/instruction"); + var route_data_1 = require("angular2/src/router/route_data"); + var hookMod = require("angular2/src/router/lifecycle_annotations"); + var route_lifecycle_reflector_1 = require("angular2/src/router/route_lifecycle_reflector"); + var _resolveToTrue = async_1.PromiseWrapper.resolve(true); + var RouterOutlet = (function() { + function RouterOutlet(_elementRef, _loader, _parentRouter, nameAttr) { + this._elementRef = _elementRef; + this._loader = _loader; + this._parentRouter = _parentRouter; + this.name = null; + this._componentRef = null; + this._currentInstruction = null; + if (lang_1.isPresent(nameAttr)) { + this.name = nameAttr; + this._parentRouter.registerAuxOutlet(this); + } else { + this._parentRouter.registerPrimaryOutlet(this); + } + } + RouterOutlet.prototype.activate = function(nextInstruction) { + var _this = this; + var previousInstruction = this._currentInstruction; + this._currentInstruction = nextInstruction; + var componentType = nextInstruction.componentType; + var childRouter = this._parentRouter.childRouter(componentType); + var bindings = di_1.Injector.resolve([di_1.bind(route_data_1.ROUTE_DATA).toValue(nextInstruction.routeData()), di_1.bind(instruction_1.RouteParams).toValue(new instruction_1.RouteParams(nextInstruction.params)), di_1.bind(routerMod.Router).toValue(childRouter)]); + return this._loader.loadNextToLocation(componentType, this._elementRef, bindings).then(function(componentRef) { + _this._componentRef = componentRef; + if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onActivate, componentType)) { + return _this._componentRef.instance.onActivate(nextInstruction, previousInstruction); + } + }); + }; + RouterOutlet.prototype.reuse = function(nextInstruction) { + var previousInstruction = this._currentInstruction; + this._currentInstruction = nextInstruction; + if (lang_1.isBlank(this._componentRef)) { + throw new exceptions_1.BaseException("Cannot reuse an outlet that does not contain a component."); + } + return async_1.PromiseWrapper.resolve(route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onReuse, this._currentInstruction.componentType) ? this._componentRef.instance.onReuse(nextInstruction, previousInstruction) : true); + }; + RouterOutlet.prototype.deactivate = function(nextInstruction) { + var _this = this; + var next = _resolveToTrue; + if (lang_1.isPresent(this._componentRef) && lang_1.isPresent(this._currentInstruction) && route_lifecycle_reflector_1.hasLifecycleHook(hookMod.onDeactivate, this._currentInstruction.componentType)) { + next = async_1.PromiseWrapper.resolve(this._componentRef.instance.onDeactivate(nextInstruction, this._currentInstruction)); + } + return next.then(function(_) { + if (lang_1.isPresent(_this._componentRef)) { + _this._componentRef.dispose(); + _this._componentRef = null; + } + }); + }; + RouterOutlet.prototype.canDeactivate = function(nextInstruction) { + if (lang_1.isBlank(this._currentInstruction)) { + return _resolveToTrue; + } + if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.canDeactivate, this._currentInstruction.componentType)) { + return async_1.PromiseWrapper.resolve(this._componentRef.instance.canDeactivate(nextInstruction, this._currentInstruction)); + } + return _resolveToTrue; + }; + RouterOutlet.prototype.canReuse = function(nextInstruction) { + var result; + if (lang_1.isBlank(this._currentInstruction) || this._currentInstruction.componentType != nextInstruction.componentType) { + result = false; + } else if (route_lifecycle_reflector_1.hasLifecycleHook(hookMod.canReuse, this._currentInstruction.componentType)) { + result = this._componentRef.instance.canReuse(nextInstruction, this._currentInstruction); + } else { + result = nextInstruction == this._currentInstruction || (lang_1.isPresent(nextInstruction.params) && lang_1.isPresent(this._currentInstruction.params) && collection_1.StringMapWrapper.equals(nextInstruction.params, this._currentInstruction.params)); + } + return async_1.PromiseWrapper.resolve(result); + }; + RouterOutlet = __decorate([metadata_1.Directive({selector: 'router-outlet'}), __param(3, metadata_1.Attribute('name')), __metadata('design:paramtypes', [compiler_1.ElementRef, compiler_1.DynamicComponentLoader, routerMod.Router, String])], RouterOutlet); + return RouterOutlet; + })(); + exports.RouterOutlet = RouterOutlet; + global.define = __define; + return module.exports; +}); + +System.register("angular2/router", ["angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/instruction", "angular2/src/router/route_registry", "angular2/src/router/location_strategy", "angular2/src/router/hash_location_strategy", "angular2/src/router/path_location_strategy", "angular2/src/router/location", "angular2/src/router/route_config_decorator", "angular2/src/router/route_definition", "angular2/src/router/lifecycle_annotations", "angular2/src/router/instruction", "angular2/angular2", "angular2/src/router/route_data", "angular2/src/router/location_strategy", "angular2/src/router/path_location_strategy", "angular2/src/router/router", "angular2/src/router/router_outlet", "angular2/src/router/router_link", "angular2/src/router/route_registry", "angular2/src/router/location", "angular2/core", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var router_1 = require("angular2/src/router/router"); + exports.Router = router_1.Router; + var router_outlet_1 = require("angular2/src/router/router_outlet"); + exports.RouterOutlet = router_outlet_1.RouterOutlet; + var router_link_1 = require("angular2/src/router/router_link"); + exports.RouterLink = router_link_1.RouterLink; + var instruction_1 = require("angular2/src/router/instruction"); + exports.RouteParams = instruction_1.RouteParams; + var route_registry_1 = require("angular2/src/router/route_registry"); + exports.RouteRegistry = route_registry_1.RouteRegistry; + var location_strategy_1 = require("angular2/src/router/location_strategy"); + exports.LocationStrategy = location_strategy_1.LocationStrategy; + var hash_location_strategy_1 = require("angular2/src/router/hash_location_strategy"); + exports.HashLocationStrategy = hash_location_strategy_1.HashLocationStrategy; + var path_location_strategy_1 = require("angular2/src/router/path_location_strategy"); + exports.PathLocationStrategy = path_location_strategy_1.PathLocationStrategy; + var location_1 = require("angular2/src/router/location"); + exports.Location = location_1.Location; + exports.APP_BASE_HREF = location_1.APP_BASE_HREF; + __export(require("angular2/src/router/route_config_decorator")); + __export(require("angular2/src/router/route_definition")); + var lifecycle_annotations_1 = require("angular2/src/router/lifecycle_annotations"); + exports.CanActivate = lifecycle_annotations_1.CanActivate; + var instruction_2 = require("angular2/src/router/instruction"); + exports.Instruction = instruction_2.Instruction; + exports.ComponentInstruction = instruction_2.ComponentInstruction; + var angular2_1 = require("angular2/angular2"); + exports.OpaqueToken = angular2_1.OpaqueToken; + var route_data_1 = require("angular2/src/router/route_data"); + exports.ROUTE_DATA = route_data_1.ROUTE_DATA; + var location_strategy_2 = require("angular2/src/router/location_strategy"); + var path_location_strategy_2 = require("angular2/src/router/path_location_strategy"); + var router_2 = require("angular2/src/router/router"); + var router_outlet_2 = require("angular2/src/router/router_outlet"); + var router_link_2 = require("angular2/src/router/router_link"); + var route_registry_2 = require("angular2/src/router/route_registry"); + var location_2 = require("angular2/src/router/location"); + var core_1 = require("angular2/core"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.ROUTER_PRIMARY_COMPONENT = lang_1.CONST_EXPR(new core_1.OpaqueToken('RouterPrimaryComponent')); + exports.ROUTER_DIRECTIVES = lang_1.CONST_EXPR([router_outlet_2.RouterOutlet, router_link_2.RouterLink]); + exports.ROUTER_BINDINGS = lang_1.CONST_EXPR([route_registry_2.RouteRegistry, lang_1.CONST_EXPR(new core_1.Binding(location_strategy_2.LocationStrategy, {toClass: path_location_strategy_2.PathLocationStrategy})), location_2.Location, lang_1.CONST_EXPR(new core_1.Binding(router_2.Router, { + toFactory: routerFactory, + deps: lang_1.CONST_EXPR([route_registry_2.RouteRegistry, location_2.Location, exports.ROUTER_PRIMARY_COMPONENT]) + }))]); + function routerFactory(registry, location, primaryComponent) { + return new router_2.RootRouter(registry, location, primaryComponent); + } + function routerBindings(primaryComponent) { + return [exports.ROUTER_BINDINGS, core_1.bind(exports.ROUTER_PRIMARY_COMPONENT).toValue(primaryComponent)]; + } + exports.routerBindings = routerBindings; + global.define = __define; + return module.exports; +}); + +//# sourceMappingURL=router.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/router.dev.js.map b/2.0.0-snapshot/router.dev.js.map new file mode 100644 index 0000000000..b11b556ce1 --- /dev/null +++ b/2.0.0-snapshot/router.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../dev/es5/angular2/src/router/instruction.js","../dev/es5/angular2/src/router/lifecycle_annotations_impl.js","../dev/es5/angular2/src/router/route_data.js","../dev/es5/angular2/src/router/lifecycle_annotations.js","../dev/es5/angular2/src/router/location_strategy.js","../dev/es5/angular2/src/router/url_parser.js","../dev/es5/angular2/src/router/route_config_impl.js","../dev/es5/angular2/src/router/async_route_handler.js","../dev/es5/angular2/src/router/sync_route_handler.js","../dev/es5/angular2/src/router/route_config_decorator.js","../dev/es5/angular2/src/router/hash_location_strategy.js","../dev/es5/angular2/src/router/path_location_strategy.js","../dev/es5/angular2/src/router/route_definition.js","../dev/es5/angular2/src/router/location.js","../dev/es5/angular2/src/router/path_recognizer.js","../dev/es5/angular2/src/router/route_config_nomalizer.js","../dev/es5/angular2/src/router/route_lifecycle_reflector.js","../dev/es5/angular2/src/router/router_link.js","../dev/es5/angular2/src/router/route_recognizer.js","../dev/es5/angular2/src/router/route_registry.js","../dev/es5/angular2/src/router/router.js","../dev/es5/angular2/src/router/router_outlet.js","../dev/es5/angular2/router.js"],"names":[],"mappings":";AAAA,KAAK,SAAS,AAAC,CAAC,iCAAgC,CAAG,EAAC,qCAAoC,CAAE,gCAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAlK,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AAgCrD,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC3B,WAAS,YAAU,CAAE,MAAK,CAAG;AACzB,SAAG,OAAO,EAAI,OAAK,CAAC;IACxB;AAAA,AACA,cAAU,UAAU,IAAI,EAAI,UAAU,KAAI,CAAG;AAAE,WAAO,CAAA,MAAK,eAAe,AAAC,CAAC,YAAW,iBAAiB,IAAI,AAAC,CAAC,IAAG,OAAO,CAAG,MAAI,CAAC,CAAC,CAAC;IAAE,CAAC;AACrI,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,YAAY,EAAI,YAAU,CAAC;AA6BjC,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC3B,WAAS,YAAU,CAAE,SAAQ,CAAG,CAAA,KAAI,CAAG,CAAA,cAAa,CAAG;AACnD,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,MAAM,EAAI,MAAI,CAAC;AAClB,SAAG,eAAe,EAAI,eAAa,CAAC;IACxC;AAAA,AAKA,cAAU,UAAU,aAAa,EAAI,UAAU,KAAI,CAAG;AAClD,WAAO,IAAI,YAAU,AAAC,CAAC,IAAG,UAAU,CAAG,MAAI,CAAG,CAAA,IAAG,eAAe,CAAC,CAAC;IACtE,CAAC;AACD,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,YAAY,EAAI,YAAU,CAAC;AAQjC,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAClC,WAAS,mBAAiB,CAAE,SAAQ,CAAG,CAAA,KAAI,CAAG,CAAA,OAAM,CAAG;AACnD,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,MAAM,EAAI,MAAI,CAAC;AAClB,SAAG,QAAQ,EAAI,QAAM,CAAC;IAC1B;AAAA,AACA,SAAO,mBAAiB,CAAC;EAC7B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAC/C,SAAS,qBAAmB,CAAE,WAAU,CAAG;AACvC,AAAI,MAAA,CAAA,MAAK,EAAI,CAAA,WAAU,UAAU,UAAU,OAAO,EAAI,EAAA,CAAA,CAClD,EAAC,GAAE,EAAI,CAAA,WAAU,UAAU,UAAU,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC,EAChD,GAAC,CAAC;AACN,SAAO,CAAA,WAAU,UAAU,QAAQ,EAAI,CAAA,YAAW,AAAC,CAAC,WAAU,CAAC,CAAA,CAC3D,CAAA,gBAAe,AAAC,CAAC,WAAU,MAAM,CAAC,CAAA,CAAI,OAAK,CAAC;EACpD;AAAA,AACA,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AACnD,SAAS,iBAAe,CAAE,WAAU,CAAG;AACnC,OAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AAC7B,WAAO,GAAC,CAAC;IACb;AAAA,AACI,MAAA,CAAA,MAAK,EAAI,CAAA,WAAU,UAAU,UAAU,OAAO,EAAI,EAAA,CAAA,CAClD,EAAC,GAAE,EAAI,CAAA,WAAU,UAAU,UAAU,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC,EAChD,GAAC,CAAC;AACN,SAAO,CAAA,GAAE,EAAI,CAAA,WAAU,UAAU,QAAQ,CAAA,CAAI,OAAK,CAAA,CAAI,CAAA,YAAW,AAAC,CAAC,WAAU,CAAC,CAAA,CAC1E,CAAA,gBAAe,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC;EAC3C;AAAA,AACA,SAAS,aAAW,CAAE,WAAU,CAAG;AAC/B,AAAI,MAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,eAAW,iBAAiB,QAAQ,AAAC,CAAC,WAAU,eAAe,CAAG,UAAU,cAAa,CAAG,CAAA,CAAA,CAAG;AAC3F,WAAK,KAAK,AAAC,CAAC,gBAAe,AAAC,CAAC,cAAa,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC;AACF,OAAI,MAAK,OAAO,EAAI,EAAA,CAAG;AACnB,WAAO,CAAA,GAAE,EAAI,CAAA,MAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,IAAE,CAAC;IACxC;AAAA,AACA,SAAO,GAAC,CAAC;EACb;AAAA,AAcI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAIpC,WAAS,qBAAmB,CAAE,OAAM,CAAG,CAAA,SAAQ,CAAG,CAAA,WAAU,CAAG,CAAA,MAAK,CAAG;AACnE,SAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,aAAK,EAAI,KAAG,CAAC;MAAE;AAAA,AACxC,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,SAAG,OAAO,EAAI,OAAK,CAAC;AACpB,SAAG,MAAM,EAAI,MAAI,CAAC;IACtB;AAAA,AACA,SAAK,eAAe,AAAC,CAAC,oBAAmB,UAAU,CAAG,gBAAc,CAAG;AAKnE,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,YAAY,QAAQ,cAAc,CAAC;MAAE;AAClE,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AAMF,uBAAmB,UAAU,qBAAqB,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,YAAY,QAAQ,qBAAqB,AAAC,EAAC,CAAC;IAAE,CAAC;AAC7H,SAAK,eAAe,AAAC,CAAC,oBAAmB,UAAU,CAAG,cAAY,CAAG;AAIjE,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,YAAY,YAAY,CAAC;MAAE;AACxD,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,oBAAmB,UAAU,CAAG,WAAS,CAAG;AAK9D,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,YAAY,SAAS,CAAC;MAAE;AACrD,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AAKF,uBAAmB,UAAU,UAAU,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,YAAY,QAAQ,KAAK,CAAC;IAAE,CAAC;AAChG,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AAjMnD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAiMmB;AClMtC,KAAK,SAAS,AAAC,CAAC,gDAA+C,CAAG,EAAC,+BAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA3I,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAClC,WAAS,mBAAiB,CAAE,IAAG,CAAG;AAC9B,SAAG,KAAK,EAAI,KAAG,CAAC;IACpB;AAAA,AACA,qBAAiB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC5B,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,mBAAiB,CAAC,CAAC;AACtB,SAAO,mBAAiB,CAAC;EAC7B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAC/C,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC3B,WAAS,YAAU,CAAE,EAAC,CAAG;AACrB,SAAG,GAAG,EAAI,GAAC,CAAC;IAChB;AAAA,AACA,cAAU,EAAI,CAAA,UAAS,AAAC,CAAC,CACrB,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,CAAC,CAAC,CAC9C,CAAG,YAAU,CAAC,CAAC;AACf,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,YAAY,EAAI,YAAU,CAAC;AACjC,QAAM,SAAS,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,UAAS,CAAC,CAAC,CAAC;AACxE,QAAM,cAAc,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,eAAc,CAAC,CAAC,CAAC;AAClF,QAAM,WAAW,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,YAAW,CAAC,CAAC,CAAC;AAC5E,QAAM,QAAQ,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,SAAQ,CAAC,CAAC,CAAC;AACtE,QAAM,aAAa,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,mBAAiB,AAAC,CAAC,cAAa,CAAC,CAAC,CAAC;AAtChF,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAsCkC;ACvCrD,KAAK,SAAS,AAAC,CAAC,gCAA+B,CAAG,EAAC,sBAAqB,CAAE,gCAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAlJ,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,QAAM,WAAW,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,IAAG,YAAY,AAAC,CAAC,WAAU,CAAC,CAAC,CAAC;AAFzE,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAEkB;ACHrC,KAAK,SAAS,AAAC,CAAC,2CAA0C,CAAG,EAAC,mCAAkC,CAAE,iDAA+C,CAAE,iDAA+C,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA5O,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AAGzB,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAC/D,AAAI,IAAA,CAAA,4BAA2B,EAAI,CAAA,OAAM,AAAC,CAAC,gDAA6B,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,4BAA2B,EAAI,CAAA,OAAM,AAAC,CAAC,gDAA6B,CAAC,CAAC;AAC1E,QAAM,SAAS,EAAI,CAAA,4BAA2B,SAAS,CAAC;AACxD,QAAM,cAAc,EAAI,CAAA,4BAA2B,cAAc,CAAC;AAClE,QAAM,WAAW,EAAI,CAAA,4BAA2B,WAAW,CAAC;AAC5D,QAAM,QAAQ,EAAI,CAAA,4BAA2B,QAAQ,CAAC;AACtD,QAAM,aAAa,EAAI,CAAA,4BAA2B,aAAa,CAAC;AAmChE,QAAM,YAAY,EAAI,CAAA,YAAW,cAAc,AAAC,CAAC,4BAA2B,YAAY,CAAC,CAAC;AA9C1F,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA8C6B;AC/ChD,KAAK,SAAS,AAAC,CAAC,uCAAsC,CAAG,EAAC,qCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAxI,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,SAAO,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,yBAAwB,CAAC,CAAC;EACpE;AAAA,AAiBI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAChC,WAAS,iBAAe,CAAC,AAAC,CAAE,GAC5B;AAAA,AACA,mBAAe,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACpE,mBAAe,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACxF,mBAAe,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACvE,mBAAe,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACpE,mBAAe,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AAC5E,mBAAe,UAAU,YAAY,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AAC3E,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AA/B3C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA+ByB;AChC5C,KAAK,SAAS,AAAC,CAAC,gCAA+B,CAAG,EAAC,qCAAoC,CAAE,gCAA8B,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAvM,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAIjE,AAAI,IAAA,CAAA,GAAE,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACnB,WAAS,IAAE,CAAE,IAAG,CAAG,CAAA,KAAI,CAAG,CAAA,SAAQ,CAAG,CAAA,MAAK,CAAG;AACzC,SAAI,KAAI,IAAM,KAAK,EAAA,CAAG;AAAE,YAAI,EAAI,KAAG,CAAC;MAAE;AAAA,AACtC,SAAI,SAAQ,IAAM,KAAK,EAAA,CAAG;AAAE,gBAAQ,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,EAAC,CAAC,CAAC;MAAE;AAAA,AAC/D,SAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,aAAK,EAAI,KAAG,CAAC;MAAE;AAAA,AACxC,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,MAAM,EAAI,MAAI,CAAC;AAClB,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,OAAO,EAAI,OAAK,CAAC;IACxB;AAAA,AACA,MAAE,UAAU,SAAS,EAAI,UAAS,AAAC,CAAE;AACjC,WAAO,CAAA,IAAG,KAAK,EAAI,CAAA,IAAG,sBAAsB,AAAC,EAAC,CAAA,CAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAA,CAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAC;IAC/F,CAAC;AACD,MAAE,UAAU,gBAAgB,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,KAAK,EAAI,CAAA,IAAG,sBAAsB,AAAC,EAAC,CAAC;IAAE,CAAC;AAChG,MAAE,UAAU,aAAa,EAAI,UAAS,AAAC,CAAE;AACrC,WAAO,CAAA,IAAG,UAAU,OAAO,EAAI,EAAA,CAAA,CAC3B,EAAC,GAAE,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,SAAU,OAAM,CAAG;AAAE,aAAO,CAAA,OAAM,SAAS,AAAC,EAAC,CAAC;MAAE,CAAC,KAAK,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,IAAE,CAAC,EAC7F,GAAC,CAAC;IACV,CAAC;AACD,MAAE,UAAU,sBAAsB,EAAI,UAAS,AAAC,CAAE;AAC9C,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,OAAO,CAAC,CAAG;AAC7B,aAAO,GAAC,CAAC;MACb;AAAA,AACA,WAAO,CAAA,GAAE,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,OAAO,CAAC,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;IACvD,CAAC;AACD,MAAE,UAAU,aAAa,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,MAAM,CAAC,CAAA,CAAI,EAAC,GAAE,EAAI,CAAA,IAAG,MAAM,SAAS,AAAC,EAAC,CAAC,EAAI,GAAC,CAAC;IAAE,CAAC;AACtH,SAAO,IAAE,CAAC;EACd,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,IAAI,EAAI,IAAE,CAAC;AACjB,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC7B,YAAQ,AAAC,CAAC,OAAM,CAAG,OAAK,CAAC,CAAC;AAC1B,WAAS,QAAM,CAAE,IAAG,CAAG,CAAA,KAAI,CAAG,CAAA,SAAQ,CAAG,CAAA,MAAK,CAAG;AAC7C,SAAI,KAAI,IAAM,KAAK,EAAA,CAAG;AAAE,YAAI,EAAI,KAAG,CAAC;MAAE;AAAA,AACtC,SAAI,SAAQ,IAAM,KAAK,EAAA,CAAG;AAAE,gBAAQ,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,EAAC,CAAC,CAAC;MAAE;AAAA,AAC/D,SAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,aAAK,EAAI,KAAG,CAAC;MAAE;AAAA,AACxC,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAG,MAAI,CAAG,UAAQ,CAAG,OAAK,CAAC,CAAC;IACrD;AAAA,AACA,UAAM,UAAU,SAAS,EAAI,UAAS,AAAC,CAAE;AACrC,WAAO,CAAA,IAAG,KAAK,EAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAA,CAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAA,CAAI,CAAA,IAAG,qBAAqB,AAAC,EAAC,CAAC;IAC9F,CAAC;AACD,UAAM,UAAU,gBAAgB,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,KAAK,EAAI,CAAA,IAAG,qBAAqB,AAAC,EAAC,CAAC;IAAE,CAAC;AACnG,UAAM,UAAU,qBAAqB,EAAI,UAAS,AAAC,CAAE;AACjD,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,OAAO,CAAC,CAAG;AAC7B,aAAO,GAAC,CAAC;MACb;AAAA,AACA,WAAO,CAAA,GAAE,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,OAAO,CAAC,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;IACvD,CAAC;AACD,SAAO,QAAM,CAAC;EAClB,CAAC,AAAC,CAAC,GAAE,CAAC,CAAC;AACP,QAAM,QAAQ,EAAI,QAAM,CAAC;AACzB,SAAS,kBAAgB,CAAE,YAAW,CAAG;AACrC,AAAI,MAAA,CAAA,GAAE,EAAI,IAAI,IAAE,AAAC,CAAC,YAAW,CAAE,YAAW,OAAO,EAAI,EAAA,CAAC,CAAC,CAAC;AACxD,QAAS,GAAA,CAAA,CAAA,EAAI,CAAA,YAAW,OAAO,EAAI,EAAA,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAClD,QAAE,EAAI,IAAI,IAAE,AAAC,CAAC,YAAW,CAAE,CAAA,CAAC,CAAG,IAAE,CAAC,CAAC;IACvC;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAAA,AACA,QAAM,kBAAkB,EAAI,kBAAgB,CAAC;AAC7C,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,MAAK,cAAc,OAAO,AAAC,CAAC,sBAAqB,CAAC,CAAC;AACpE,SAAS,gBAAc,CAAE,GAAE,CAAG;AAC1B,AAAI,MAAA,CAAA,KAAI,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,UAAS,CAAG,IAAE,CAAC,CAAC;AAC5D,SAAO,CAAA,MAAK,UAAU,AAAC,CAAC,KAAI,CAAC,CAAA,CAAI,CAAA,KAAI,CAAE,CAAA,CAAC,EAAI,KAAG,CAAC;EACpD;AAAA,AACI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACzB,WAAS,UAAQ,CAAC,AAAC,CAAE,GACrB;AAAA,AACA,YAAQ,UAAU,eAAe,EAAI,UAAU,GAAE,CAAG;AAAE,WAAO,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,IAAG,WAAW,CAAG,IAAE,CAAC,CAAC;IAAE,CAAC;AACrH,YAAQ,UAAU,QAAQ,EAAI,UAAU,GAAE,CAAG;AACzC,SAAI,CAAC,MAAK,cAAc,WAAW,AAAC,CAAC,IAAG,WAAW,CAAG,IAAE,CAAC,CAAG;AACxD,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,aAAY,EAAI,IAAE,CAAA,CAAI,MAAI,CAAC,CAAC;MACrE;AAAA,AACA,SAAG,WAAW,EAAI,CAAA,IAAG,WAAW,UAAU,AAAC,CAAC,GAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;AACD,YAAQ,UAAU,MAAM,EAAI,UAAU,GAAE,CAAG;AACvC,SAAG,WAAW,EAAI,IAAE,CAAC;AACrB,SAAI,GAAE,GAAK,GAAC,CAAA,EAAK,CAAA,GAAE,GAAK,IAAE,CAAG;AACzB,aAAO,IAAI,IAAE,AAAC,CAAC,EAAC,CAAC,CAAC;MACtB;AAAA,AACA,WAAO,CAAA,IAAG,UAAU,AAAC,EAAC,CAAC;IAC3B,CAAC;AAED,YAAQ,UAAU,UAAU,EAAI,UAAS,AAAC,CAAE;AACxC,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;MACrB;AAAA,AACI,QAAA,CAAA,IAAG,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AAC3C,SAAG,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AAClB,AAAI,QAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,UAAE,EAAI,CAAA,IAAG,qBAAqB,AAAC,EAAC,CAAC;MACrC;AAAA,AACA,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAE1B,WAAG,kBAAkB,AAAC,EAAC,CAAC;MAC5B;AAAA,AACI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAA,EAAK,EAAC,IAAG,eAAe,AAAC,CAAC,IAAG,CAAC,CAAG;AACxD,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,YAAI,EAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAC;MAC/B;AAAA,AACI,QAAA,CAAA,WAAU,EAAI,KAAG,CAAC;AACtB,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,kBAAU,EAAI,CAAA,IAAG,iBAAiB,AAAC,EAAC,CAAC;MACzC;AAAA,AACA,WAAO,IAAI,QAAM,AAAC,CAAC,IAAG,CAAG,MAAI,CAAG,IAAE,CAAG,YAAU,CAAC,CAAC;IACrD,CAAC;AAED,YAAQ,UAAU,aAAa,EAAI,UAAS,AAAC,CAAE;AAC3C,SAAI,IAAG,WAAW,OAAO,GAAK,EAAA,CAAG;AAC7B,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;MACrB;AAAA,AACI,QAAA,CAAA,IAAG,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AAC3C,SAAG,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AAClB,AAAI,QAAA,CAAA,YAAW,EAAI,KAAG,CAAC;AACvB,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,mBAAW,EAAI,CAAA,IAAG,kBAAkB,AAAC,EAAC,CAAC;MAC3C;AAAA,AACI,QAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,UAAE,EAAI,CAAA,IAAG,qBAAqB,AAAC,EAAC,CAAC;MACrC;AAAA,AACI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAA,EAAK,EAAC,IAAG,eAAe,AAAC,CAAC,IAAG,CAAC,CAAG;AACxD,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,YAAI,EAAI,CAAA,IAAG,aAAa,AAAC,EAAC,CAAC;MAC/B;AAAA,AACA,WAAO,IAAI,IAAE,AAAC,CAAC,IAAG,CAAG,MAAI,CAAG,IAAE,CAAG,aAAW,CAAC,CAAC;IAClD,CAAC;AACD,YAAQ,UAAU,iBAAiB,EAAI,UAAS,AAAC,CAAE;AAC/C,AAAI,QAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,SAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,SAAG,WAAW,AAAC,CAAC,MAAK,CAAC,CAAC;AACvB,YAAO,IAAG,WAAW,OAAO,EAAI,EAAA,CAAA,EAAK,CAAA,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC3D,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,WAAG,WAAW,AAAC,CAAC,MAAK,CAAC,CAAC;MAC3B;AAAA,AACA,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,YAAQ,UAAU,kBAAkB,EAAI,UAAS,AAAC,CAAE;AAChD,AAAI,QAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,YAAO,IAAG,WAAW,OAAO,EAAI,EAAA,CAAA,EAAK,CAAA,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC3D,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,WAAG,WAAW,AAAC,CAAC,MAAK,CAAC,CAAC;MAC3B;AAAA,AACA,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,YAAQ,UAAU,WAAW,EAAI,UAAU,MAAK,CAAG;AAC/C,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AAC1C,SAAI,MAAK,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACrB,eAAM;MACV;AAAA,AACA,SAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAG;AAC1B,WAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,AAAI,UAAA,CAAA,UAAS,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AACjD,WAAI,MAAK,UAAU,AAAC,CAAC,UAAS,CAAC,CAAG;AAC9B,cAAI,EAAI,WAAS,CAAC;AAClB,aAAG,QAAQ,AAAC,CAAC,KAAI,CAAC,CAAC;QACvB;AAAA,MACJ;AAAA,AACA,WAAK,CAAE,GAAE,CAAC,EAAI,MAAI,CAAC;IACvB,CAAC;AACD,YAAQ,UAAU,qBAAqB,EAAI,UAAS,AAAC,CAAE;AACnD,AAAI,QAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,SAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,YAAO,CAAC,IAAG,eAAe,AAAC,CAAC,GAAE,CAAC,CAAA,EAAK,CAAA,IAAG,WAAW,OAAO,EAAI,EAAA,CAAG;AAC5D,aAAK,KAAK,AAAC,CAAC,IAAG,aAAa,AAAC,EAAC,CAAC,CAAC;AAChC,WAAI,IAAG,eAAe,AAAC,CAAC,IAAG,CAAC,CAAG;AAC3B,aAAG,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;QACtB;AAAA,MACJ;AAAA,AACA,SAAG,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAC;AACjB,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,SAAO,UAAQ,CAAC;EACpB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,UAAU,EAAI,UAAQ,CAAC;AAC7B,QAAM,OAAO,EAAI,IAAI,UAAQ,AAAC,EAAC,CAAC;AAChC,SAAS,gBAAc,CAAE,QAAO,CAAG;AAC/B,AAAI,MAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,OAAI,MAAK,UAAU,AAAC,CAAC,QAAO,CAAC,CAAG;AAC5B,iBAAW,iBAAiB,QAAQ,AAAC,CAAC,QAAO,CAAG,UAAU,KAAI,CAAG,CAAA,GAAE,CAAG;AAClE,WAAI,KAAI,GAAK,KAAG,CAAG;AACf,eAAK,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;QACpB,KACK;AACD,eAAK,KAAK,AAAC,CAAC,GAAE,EAAI,IAAE,CAAA,CAAI,MAAI,CAAC,CAAC;QAClC;AAAA,MACJ,CAAC,CAAC;IACN;AAAA,AACA,SAAO,OAAK,CAAC;EACjB;AAAA,AACA,QAAM,gBAAgB,EAAI,gBAAc,CAAC;AAhNzC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAgNkB;ACjNrC,KAAK,SAAS,AAAC,CAAC,uCAAsC,CAAG,EAAC,+BAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAlI,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AAMrD,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC3B,WAAS,YAAU,CAAE,OAAM,CAAG;AAC1B,SAAG,QAAQ,EAAI,QAAM,CAAC;IAC1B;AAAA,AACA,cAAU,EAAI,CAAA,UAAS,AAAC,CAAC,CACrB,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,KAAI,CAAC,CAAC,CAC3C,CAAG,YAAU,CAAC,CAAC;AACf,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,YAAY,EAAI,YAAU,CAAC;AAqBjC,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACrB,WAAS,MAAI,CAAE,EAAC,CAAG;AACf,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,EAAC,KAAK;AAAG,kBAAQ,EAAI,CAAA,EAAC,UAAU;AAAG,WAAC,EAAI,CAAA,EAAC,GAAG;AAAG,aAAG,EAAI,CAAA,EAAC,KAAK,CAAC;AACxE,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,GAAG,EAAI,GAAC,CAAC;AACZ,SAAG,OAAO,EAAI,KAAG,CAAC;AAClB,SAAG,WAAW,EAAI,KAAG,CAAC;AACtB,SAAG,KAAK,EAAI,KAAG,CAAC;IACpB;AAAA,AACA,QAAI,EAAI,CAAA,UAAS,AAAC,CAAC,CACf,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,MAAI,CAAC,CAAC;AACT,SAAO,MAAI,CAAC;EAChB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,MAAM,EAAI,MAAI,CAAC;AAqBrB,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACxB,WAAS,SAAO,CAAE,EAAC,CAAG;AAClB,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,EAAC,KAAK;AAAG,kBAAQ,EAAI,CAAA,EAAC,UAAU;AAAG,WAAC,EAAI,CAAA,EAAC,GAAG,CAAC;AACxD,SAAG,KAAK,EAAI,KAAG,CAAC;AAEhB,SAAG,OAAO,EAAI,KAAG,CAAC;AAClB,SAAG,WAAW,EAAI,KAAG,CAAC;AACtB,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,GAAG,EAAI,GAAC,CAAC;IAChB;AAAA,AACA,WAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,SAAO,CAAC,CAAC;AACZ,SAAO,SAAO,CAAC;EACnB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,SAAS,EAAI,SAAO,CAAC;AAsB3B,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC1B,WAAS,WAAS,CAAE,EAAC,CAAG;AACpB,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,EAAC,KAAK;AAAG,eAAK,EAAI,CAAA,EAAC,OAAO;AAAG,WAAC,EAAI,CAAA,EAAC,GAAG;AAAG,aAAG,EAAI,CAAA,EAAC,KAAK,CAAC;AAClE,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,OAAO,EAAI,OAAK,CAAC;AACpB,SAAG,GAAG,EAAI,GAAC,CAAC;AACZ,SAAG,KAAK,EAAI,KAAG,CAAC;IACpB;AAAA,AACA,aAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,WAAS,CAAC,CAAC;AACd,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,WAAW,EAAI,WAAS,CAAC;AAoB/B,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACxB,WAAS,SAAO,CAAE,EAAC,CAAG;AAClB,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,EAAC,KAAK;AAAG,mBAAS,EAAI,CAAA,EAAC,WAAW,CAAC;AAC9C,SAAG,GAAG,EAAI,KAAG,CAAC;AAEd,SAAG,OAAO,EAAI,KAAG,CAAC;AAClB,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,WAAW,EAAI,WAAS,CAAC;IAChC;AAAA,AACA,WAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,MAAK,MAAM,AAAC,EAAC,CACb,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,SAAO,CAAC,CAAC;AACZ,SAAO,SAAO,CAAC;EACnB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,SAAS,EAAI,SAAO,CAAC;AA9K3B,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA8KyB;AC/K5C,KAAK,SAAS,AAAC,CAAC,yCAAwC,CAAG,EAAC,+BAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAApI,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,iBAAgB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACjC,WAAS,kBAAgB,CAAE,OAAM,CAAG,CAAA,IAAG,CAAG;AACtC,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,mBAAmB,EAAI,KAAG,CAAC;IAClC;AAAA,AACA,oBAAgB,UAAU,qBAAqB,EAAI,UAAS,AAAC,CAAE;AAC3D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,mBAAmB,CAAC,CAAG;AAC3C,aAAO,CAAA,IAAG,mBAAmB,CAAC;MAClC;AAAA,AACA,WAAO,CAAA,IAAG,mBAAmB,EAAI,CAAA,IAAG,QAAQ,AAAC,EAAC,KAAK,AAAC,CAAC,SAAU,aAAY,CAAG;AAC1E,YAAI,cAAc,EAAI,cAAY,CAAC;AACnC,aAAO,cAAY,CAAC;MACxB,CAAC,CAAC;IACN,CAAC;AACD,SAAO,kBAAgB,CAAC;EAC5B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,kBAAkB,EAAI,kBAAgB,CAAC;AAnB7C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAmB2B;ACpB9C,KAAK,SAAS,AAAC,CAAC,wCAAuC,CAAG,EAAC,gCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAApI,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAChC,WAAS,iBAAe,CAAE,aAAY,CAAG,CAAA,IAAG,CAAG;AAC3C,SAAG,cAAc,EAAI,cAAY,CAAC;AAClC,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,mBAAmB,EAAI,KAAG,CAAC;AAC9B,SAAG,mBAAmB,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAC;IAC3E;AAAA,AACA,mBAAe,UAAU,qBAAqB,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,mBAAmB,CAAC;IAAE,CAAC;AACjG,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AAX3C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAW0B;ACZ7C,KAAK,SAAS,AAAC,CAAC,4CAA2C,CAAG,EAAC,uCAAsC,CAAE,oCAAkC,CAAE,wCAAsC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA3N,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AACxD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAC/D,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AACxD,QAAM,MAAM,EAAI,CAAA,mBAAkB,MAAM,CAAC;AACzC,QAAM,SAAS,EAAI,CAAA,mBAAkB,SAAS,CAAC;AAC/C,QAAM,SAAS,EAAI,CAAA,mBAAkB,SAAS,CAAC;AAC/C,QAAM,WAAW,EAAI,CAAA,mBAAkB,WAAW,CAAC;AACnD,QAAM,YAAY,EAAI,CAAA,YAAW,cAAc,AAAC,CAAC,mBAAkB,YAAY,CAAC,CAAC;AAPjF,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAO8B;ACRjD,KAAK,SAAS,AAAC,CAAC,4CAA2C,CAAG,EAAC,mCAAkC,CAAE,uBAAqB,CAAE,wCAAsC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA1M,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AAwCxD,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC1C,YAAQ,AAAC,CAAC,oBAAmB,CAAG,OAAK,CAAC,CAAC;AACvC,WAAS,qBAAmB,CAAC,AAAC,CAAE;AAC5B,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,CAAA,aAAY,IAAI,YAAY,AAAC,EAAC,CAAC;AAChD,SAAG,SAAS,EAAI,CAAA,aAAY,IAAI,WAAW,AAAC,EAAC,CAAC;IAClD;AAAA,AACA,uBAAmB,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AACtD,kBAAY,IAAI,qBAAqB,AAAC,CAAC,QAAO,CAAC,iBAAiB,AAAC,CAAC,UAAS,CAAG,GAAC,CAAG,MAAI,CAAC,CAAC;IAC5F,CAAC;AACD,uBAAmB,UAAU,YAAY,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,GAAC,CAAC;IAAE,CAAC;AACvE,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAG9C,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,IAAG,UAAU,KAAK,CAAC;AAI9B,WAAO,CAAA,IAAG,OAAO,EAAI,EAAA,CAAA,CAAI,CAAA,IAAG,UAAU,AAAC,CAAC,CAAA,CAAC,CAAA,CAAI,KAAG,CAAC;IACrD,CAAC;AACD,uBAAmB,UAAU,UAAU,EAAI,UAAU,KAAI,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AACpE,SAAG,SAAS,UAAU,AAAC,CAAC,KAAI,CAAG,MAAI,CAAG,CAAA,GAAE,EAAI,IAAE,CAAC,CAAC;IACpD,CAAC;AACD,uBAAmB,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,SAAS,QAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACjF,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,SAAS,KAAK,AAAC,EAAC,CAAC;IAAE,CAAC;AAC3E,uBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,qBAAmB,CAAC,CAAC;AACxB,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,CAAC;AACxC,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AA1FnD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA0F8B;AC3FjD,KAAK,SAAS,AAAC,CAAC,4CAA2C,CAAG,EAAC,mCAAkC,CAAE,uBAAqB,CAAE,wCAAsC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA1M,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AA+CxD,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC1C,YAAQ,AAAC,CAAC,oBAAmB,CAAG,OAAK,CAAC,CAAC;AACvC,WAAS,qBAAmB,CAAC,AAAC,CAAE;AAC5B,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,CAAA,aAAY,IAAI,YAAY,AAAC,EAAC,CAAC;AAChD,SAAG,SAAS,EAAI,CAAA,aAAY,IAAI,WAAW,AAAC,EAAC,CAAC;AAC9C,SAAG,UAAU,EAAI,CAAA,aAAY,IAAI,YAAY,AAAC,EAAC,CAAC;IACpD;AAAA,AACA,uBAAmB,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AACtD,kBAAY,IAAI,qBAAqB,AAAC,CAAC,QAAO,CAAC,iBAAiB,AAAC,CAAC,UAAS,CAAG,GAAC,CAAG,MAAI,CAAC,CAAC;IAC5F,CAAC;AACD,uBAAmB,UAAU,YAAY,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,CAAC;IAAE,CAAC;AACnF,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,SAAS,CAAC;IAAE,CAAC;AACrF,uBAAmB,UAAU,UAAU,EAAI,UAAU,KAAI,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,SAAG,SAAS,UAAU,AAAC,CAAC,KAAI,CAAG,MAAI,CAAG,IAAE,CAAC,CAAC;IAAE,CAAC;AACvH,uBAAmB,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,SAAS,QAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACjF,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,SAAS,KAAK,AAAC,EAAC,CAAC;IAAE,CAAC;AAC3E,uBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,qBAAmB,CAAC,CAAC;AACxB,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,CAAC;AACxC,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AAxFnD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAwF8B;ACzFjD,KAAK,SAAS,AAAC,CAAC,sCAAqC,CAAG,GAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAlG,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AADwB;ACA3C,KAAK,SAAS,AAAC,CAAC,8BAA6B,CAAG,EAAC,uCAAsC,CAAE,gCAA8B,CAAE,iCAA+B,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,uBAAqB,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA/R,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,SAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,cAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;IAAE,CAAA;EACxE,CAAC;AACD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AACxD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AA+B1C,QAAM,cAAc,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,IAAG,YAAY,AAAC,CAAC,aAAY,CAAC,CAAC,CAAC;AA0C9E,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACxB,WAAS,SAAO,CAAE,gBAAe,CAAG,CAAA,IAAG,CAAG;AACtC,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAG,iBAAiB,EAAI,iBAAe,CAAC;AACxC,SAAG,SAAS,EAAI,IAAI,CAAA,OAAM,aAAa,AAAC,EAAC,CAAC;AAC1C,AAAI,QAAA,CAAA,eAAc,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,KAAG,EAAI,CAAA,IAAG,iBAAiB,YAAY,AAAC,EAAC,CAAC;AACzF,SAAI,MAAK,QAAQ,AAAC,CAAC,eAAc,CAAC,CAAG;AACjC,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,2FAA0F,CAAC,CAAC;MACrI;AAAA,AACA,SAAG,UAAU,EAAI,CAAA,kBAAiB,AAAC,CAAC,cAAa,AAAC,CAAC,eAAc,CAAC,CAAC,CAAC;AACpE,SAAG,iBAAiB,WAAW,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,cAAM,kBAAkB,SAAS,AAAC,CAAC,KAAI,SAAS,CAAG;AAAE,cAAI,CAAG,CAAA,KAAI,KAAK,AAAC,EAAC;AAAG,cAAI,CAAG,KAAG;AAAA,QAAE,CAAC,CAAC;MAAE,CAAC,CAAC;IAChJ;AAAA,AAIA,WAAO,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,iBAAiB,KAAK,AAAC,EAAC,CAAC,CAAC;IAAE,CAAC;AAI9F,WAAO,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG;AAC1C,WAAO,CAAA,kBAAiB,AAAC,CAAC,cAAa,AAAC,CAAC,IAAG,UAAU,CAAG,CAAA,cAAa,AAAC,CAAC,GAAE,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;AAMD,WAAO,UAAU,oBAAoB,EAAI,UAAU,GAAE,CAAG;AACpD,SAAI,CAAC,GAAE,WAAW,AAAC,CAAC,GAAE,CAAC,CAAG;AACtB,UAAE,EAAI,CAAA,GAAE,EAAI,IAAE,CAAC;MACnB;AAAA,AACA,WAAO,CAAA,kBAAiB,AAAC,CAAC,YAAW,AAAC,CAAC,IAAG,UAAU,CAAG,IAAE,CAAC,CAAC,CAAC;IAChE,CAAC;AAKD,WAAO,UAAU,GAAG,EAAI,UAAU,GAAE,CAAG;AACnC,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,IAAG,oBAAoB,AAAC,CAAC,GAAE,CAAC,CAAC;AAC5C,SAAG,iBAAiB,UAAU,AAAC,CAAC,IAAG,CAAG,GAAC,CAAG,SAAO,CAAC,CAAC;IACvD,CAAC;AAID,WAAO,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,iBAAiB,QAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AAI7E,WAAO,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,iBAAiB,KAAK,AAAC,EAAC,CAAC;IAAE,CAAC;AAIvE,WAAO,UAAU,UAAU,EAAI,UAAU,MAAK,CAAG,CAAA,OAAM,CAAG,CAAA,QAAO,CAAG;AAChE,SAAI,OAAM,IAAM,KAAK,EAAA,CAAG;AAAE,cAAM,EAAI,KAAG,CAAC;MAAE;AAAA,AAC1C,SAAI,QAAO,IAAM,KAAK,EAAA,CAAG;AAAE,eAAO,EAAI,KAAG,CAAC;MAAE;AAAA,AAC5C,YAAM,kBAAkB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,OAAK,CAAG,QAAM,CAAG,SAAO,CAAC,CAAC;IACjF,CAAC;AACD,WAAO,EAAI,CAAA,UAAS,AAAC,CAAC,CAClB,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,SAAS,AAAC,EAAC,CAAC,CAC1B,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,OAAO,AAAC,CAAC,OAAM,cAAc,CAAC,CAAC,CAC7C,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,mBAAkB,iBAAiB,CAAG,OAAK,CAAC,CAAC,CAClF,CAAG,SAAO,CAAC,CAAC;AACZ,SAAO,SAAO,CAAC;EACnB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,SAAS,EAAI,SAAO,CAAC;AAC3B,SAAS,eAAa,CAAE,QAAO,CAAG,CAAA,GAAE,CAAG;AACnC,OAAI,QAAO,OAAO,EAAI,EAAA,CAAA,EAAK,CAAA,GAAE,WAAW,AAAC,CAAC,QAAO,CAAC,CAAG;AACjD,WAAO,CAAA,GAAE,UAAU,AAAC,CAAC,QAAO,OAAO,CAAC,CAAC;IACzC;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAAA,AACA,SAAS,aAAW,CAAE,QAAO,CAAG,CAAA,GAAE,CAAG;AACjC,OAAI,CAAC,GAAE,WAAW,AAAC,CAAC,QAAO,CAAC,CAAG;AAC3B,WAAO,CAAA,QAAO,EAAI,IAAE,CAAC;IACzB;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAAA,AACA,SAAS,eAAa,CAAE,GAAE,CAAG;AACzB,OAAI,gBAAe,KAAK,AAAC,CAAC,GAAE,CAAC,CAAG;AAE5B,WAAO,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,CAAA,GAAE,OAAO,EAAI,GAAC,CAAC,CAAC;IAC5C;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAAA,AACA,SAAS,mBAAiB,CAAE,GAAE,CAAG;AAC7B,OAAI,MAAK,KAAK,AAAC,CAAC,GAAE,CAAC,CAAG;AAClB,QAAE,EAAI,CAAA,GAAE,UAAU,AAAC,CAAC,CAAA,CAAG,CAAA,GAAE,OAAO,EAAI,EAAA,CAAC,CAAC;IAC1C;AAAA,AACA,SAAO,IAAE,CAAC;EACd;AAtLA,AAsLA,OAtLK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAsLgB;ACvLnC,KAAK,SAAS,AAAC,CAAC,qCAAoC,CAAG,EAAC,+BAA8B,CAAE,sCAAoC,CAAE,sCAAoC,CAAE,iCAA+B,CAAE,kCAAgC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA/Q,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,gCAAa,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAc,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACxB,WAAS,SAAO,CAAE,GAAE,CAAG;AACnB,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAG,IAAI,EAAI,GAAC,CAAC;AACb,SAAG,KAAK,EAAI,GAAC,CAAC;AACd,SAAI,MAAK,UAAU,AAAC,CAAC,GAAE,CAAC,CAAG;AACvB,mBAAW,iBAAiB,QAAQ,AAAC,CAAC,GAAE,CAAG,UAAU,KAAI,CAAG,CAAA,GAAE,CAAG;AAC7D,cAAI,IAAI,CAAE,GAAE,CAAC,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,KAAI,CAAC,CAAA,CAAI,CAAA,KAAI,SAAS,AAAC,EAAC,CAAA,CAAI,KAAG,CAAC;AAClE,cAAI,KAAK,CAAE,GAAE,CAAC,EAAI,KAAG,CAAC;QAC1B,CAAC,CAAC;MACN;AAAA,IACJ;AAAA,AACA,WAAO,UAAU,IAAI,EAAI,UAAU,GAAE,CAAG;AACpC,iBAAW,iBAAiB,OAAO,AAAC,CAAC,IAAG,KAAK,CAAG,IAAE,CAAC,CAAC;AACpD,WAAO,CAAA,IAAG,IAAI,CAAE,GAAE,CAAC,CAAC;IACxB,CAAC;AACD,WAAO,UAAU,UAAU,EAAI,UAAS,AAAC,CAAE;AACvC,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,YAAW,iBAAiB,OAAO,AAAC,EAAC,CAAC;AACnD,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,YAAW,iBAAiB,KAAK,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC;AACxD,iBAAW,YAAY,QAAQ,AAAC,CAAC,IAAG,CAAG,UAAU,GAAE,CAAG;AAAE,aAAK,CAAE,GAAE,CAAC,EAAI,CAAA,YAAW,iBAAiB,IAAI,AAAC,CAAC,KAAI,IAAI,CAAG,IAAE,CAAC,CAAC;MAAE,CAAC,CAAC;AAC3H,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,SAAO,SAAO,CAAC;EACnB,CAAC,AAAC,EAAC,CAAC;AACJ,SAAS,gBAAc,CAAE,GAAE,CAAG;AAC1B,OAAI,MAAK,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACrB,WAAO,KAAG,CAAC;IACf,KACK;AACD,WAAO,CAAA,GAAE,SAAS,AAAC,EAAC,CAAC;IACzB;AAAA,EACJ;AAAA,AACI,IAAA,CAAA,mBAAkB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACnC,WAAS,oBAAkB,CAAC,AAAC,CAAE;AAC3B,SAAG,KAAK,EAAI,GAAC,CAAC;IAClB;AAAA,AACA,sBAAkB,UAAU,SAAS,EAAI,UAAU,MAAK,CAAG;AAAE,WAAO,GAAC,CAAC;IAAE,CAAC;AACzE,sBAAkB,UAAU,MAAM,EAAI,UAAU,IAAG,CAAG;AAAE,WAAO,KAAG,CAAC;IAAE,CAAC;AACtE,SAAO,oBAAkB,CAAC;EAC9B,CAAC,AAAC,EAAC,CAAC;AACJ,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC7B,WAAS,cAAY,CAAE,IAAG,CAAG;AACzB,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,KAAK,EAAI,GAAC,CAAC;IAClB;AAAA,AACA,gBAAY,UAAU,MAAM,EAAI,UAAU,IAAG,CAAG;AAAE,WAAO,CAAA,IAAG,GAAK,CAAA,IAAG,KAAK,CAAC;IAAE,CAAC;AAC7E,gBAAY,UAAU,SAAS,EAAI,UAAU,MAAK,CAAG;AAAE,WAAO,CAAA,IAAG,KAAK,CAAC;IAAE,CAAC;AAC1E,SAAO,cAAY,CAAC;EACxB,CAAC,AAAC,EAAC,CAAC;AACJ,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC9B,WAAS,eAAa,CAAE,IAAG,CAAG;AAC1B,SAAG,KAAK,EAAI,KAAG,CAAC;IACpB;AAAA,AACA,iBAAa,UAAU,MAAM,EAAI,UAAU,IAAG,CAAG;AAAE,WAAO,CAAA,IAAG,OAAO,EAAI,EAAA,CAAC;IAAE,CAAC;AAC5E,iBAAa,UAAU,SAAS,EAAI,UAAU,MAAK,CAAG;AAClD,SAAI,CAAC,YAAW,iBAAiB,SAAS,AAAC,CAAC,MAAK,IAAI,CAAG,CAAA,IAAG,KAAK,CAAC,CAAG;AAChE,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,uBAAsB,EAAI,CAAA,IAAG,KAAK,CAAA,CAAI,2CAAyC,CAAC,CAAC;MAC1H;AAAA,AACA,WAAO,CAAA,eAAc,AAAC,CAAC,MAAK,IAAI,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC,CAAC;IACjD,CAAC;AACD,SAAO,eAAa,CAAC;EACzB,CAAC,AAAC,EAAC,CAAC;AACJ,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC3B,WAAS,YAAU,CAAE,IAAG,CAAG;AACvB,SAAG,KAAK,EAAI,KAAG,CAAC;IACpB;AAAA,AACA,cAAU,UAAU,MAAM,EAAI,UAAU,IAAG,CAAG;AAAE,WAAO,KAAG,CAAC;IAAE,CAAC;AAC9D,cAAU,UAAU,SAAS,EAAI,UAAU,MAAK,CAAG;AAAE,WAAO,CAAA,eAAc,AAAC,CAAC,MAAK,IAAI,AAAC,CAAC,IAAG,KAAK,CAAC,CAAC,CAAC;IAAE,CAAC;AACrG,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,EAAC,CAAC;AACJ,AAAI,IAAA,CAAA,YAAW,EAAI,eAAa,CAAC;AACjC,AAAI,IAAA,CAAA,eAAc,EAAI,gBAAc,CAAC;AACrC,SAAS,gBAAc,CAAE,KAAI,CAAG;AAG5B,OAAI,MAAK,cAAc,WAAW,AAAC,CAAC,KAAI,CAAG,IAAE,CAAC,CAAG;AAC7C,UAAI,EAAI,CAAA,MAAK,cAAc,UAAU,AAAC,CAAC,KAAI,CAAG,EAAA,CAAC,CAAC;IACpD;AAAA,AACI,MAAA,CAAA,QAAO,EAAI,CAAA,YAAW,AAAC,CAAC,KAAI,CAAC,CAAC;AAClC,AAAI,MAAA,CAAA,OAAM,EAAI,GAAC,CAAC;AAChB,AAAI,MAAA,CAAA,WAAU,EAAI,EAAA,CAAC;AAWnB,OAAI,QAAO,OAAO,EAAI,GAAC,CAAG;AACtB,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,GAAE,EAAI,MAAI,CAAA,CAAI,4DAA0D,CAAC,CAAC;IACnH;AAAA,AACI,MAAA,CAAA,KAAI,EAAI,CAAA,QAAO,OAAO,EAAI,EAAA,CAAC;AAC/B,QAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,GAAK,MAAI,CAAG,CAAA,CAAA,EAAE,CAAG;AAC7B,AAAI,QAAA,CAAA,OAAM,EAAI,CAAA,QAAO,CAAE,CAAA,CAAC;AAAG,cAAI,CAAC;AAChC,SAAI,MAAK,UAAU,AAAC,CAAC,KAAI,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,YAAW,CAAG,QAAM,CAAC,CAAC,CAAG;AAClF,cAAM,KAAK,AAAC,CAAC,GAAI,eAAa,AAAC,CAAC,KAAI,CAAE,CAAA,CAAC,CAAC,CAAC,CAAC;AAC1C,kBAAU,GAAK,EAAC,GAAE,EAAI,EAAA,CAAC,CAAC;MAC5B,KACK,KAAI,MAAK,UAAU,AAAC,CAAC,KAAI,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,eAAc,CAAG,QAAM,CAAC,CAAC,CAAG;AAC1F,cAAM,KAAK,AAAC,CAAC,GAAI,YAAU,AAAC,CAAC,KAAI,CAAE,CAAA,CAAC,CAAC,CAAC,CAAC;MAC3C,KACK,KAAI,OAAM,GAAK,MAAI,CAAG;AACvB,WAAI,CAAA,EAAI,MAAI,CAAG;AAEX,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,sDAAqD,EAAI,MAAI,CAAA,CAAI,MAAI,CAAC,CAAC;QAChH;AAAA,AACA,cAAM,KAAK,AAAC,CAAC,GAAI,oBAAkB,AAAC,EAAC,CAAC,CAAC;MAC3C,KACK;AACD,cAAM,KAAK,AAAC,CAAC,GAAI,cAAY,AAAC,CAAC,OAAM,CAAC,CAAC,CAAC;AACxC,kBAAU,GAAK,CAAA,GAAE,EAAI,EAAC,GAAE,EAAI,EAAA,CAAC,CAAC;MAClC;AAAA,IACJ;AAAA,AACI,MAAA,CAAA,MAAK,EAAI,CAAA,YAAW,iBAAiB,OAAO,AAAC,EAAC,CAAC;AACnD,eAAW,iBAAiB,IAAI,AAAC,CAAC,MAAK,CAAG,WAAS,CAAG,QAAM,CAAC,CAAC;AAC9D,eAAW,iBAAiB,IAAI,AAAC,CAAC,MAAK,CAAG,cAAY,CAAG,YAAU,CAAC,CAAC;AACrE,SAAO,OAAK,CAAC;EACjB;AAAA,AAGA,SAAS,YAAU,CAAE,QAAO,CAAG;AAC3B,SAAO,CAAA,QAAO,IAAI,AAAC,CAAC,SAAU,OAAM,CAAG;AACnC,SAAI,OAAM,WAAa,YAAU,CAAG;AAChC,aAAO,IAAE,CAAC;MACd,KACK,KAAI,OAAM,WAAa,oBAAkB,CAAG;AAC7C,aAAO,MAAI,CAAC;MAChB,KACK,KAAI,OAAM,WAAa,eAAa,CAAG;AACxC,aAAO,IAAE,CAAC;MACd,KACK,KAAI,OAAM,WAAa,cAAY,CAAG;AACvC,aAAO,CAAA,OAAM,KAAK,CAAC;MACvB;AAAA,IACJ,CAAC,KACO,AAAC,CAAC,GAAE,CAAC,CAAC;EAClB;AAAA,AACA,SAAS,aAAW,CAAE,GAAE,CAAG;AACvB,SAAO,CAAA,GAAE,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;EACzB;AAAA,AACI,IAAA,CAAA,cAAa,EAAI,CAAA,MAAK,cAAc,OAAO,AAAC,CAAC,oBAAmB,CAAC,CAAC;AACtE,SAAS,WAAS,CAAE,IAAG,CAAG;AACtB,OAAI,MAAK,cAAc,SAAS,AAAC,CAAC,IAAG,CAAG,IAAE,CAAC,CAAG;AAC1C,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,KAAG,CAAA,CAAI,qEAAmE,CAAC,CAAC;IACjI;AAAA,AACI,MAAA,CAAA,gBAAe,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,cAAa,CAAG,KAAG,CAAC,CAAC;AAC5E,OAAI,MAAK,UAAU,AAAC,CAAC,gBAAe,CAAC,CAAG;AACpC,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,KAAG,CAAA,CAAI,iBAAe,CAAA,CAAI,CAAA,gBAAe,CAAE,CAAA,CAAC,CAAA,CAAI,6CAA2C,CAAC,CAAC;IAClJ;AAAA,EACJ;AAAA,AACI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACzB,WAAS,UAAQ,CAAE,WAAU,CAAG,CAAA,SAAQ,CAAG,CAAA,YAAW,CAAG;AACrD,SAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,aAAa,EAAI,aAAW,CAAC;IACpC;AAAA,AACA,SAAO,UAAQ,CAAC;EACpB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,UAAU,EAAI,UAAQ,CAAC;AAE7B,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAE9B,WAAS,eAAa,CAAE,IAAG,CAAG,CAAA,OAAM,CAAG;AACnC,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,SAAS,EAAI,KAAG,CAAC;AACpB,SAAG,OAAO,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACpC,eAAS,AAAC,CAAC,IAAG,CAAC,CAAC;AAChB,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,eAAc,AAAC,CAAC,IAAG,CAAC,CAAC;AAClC,SAAG,UAAU,EAAI,CAAA,MAAK,CAAE,UAAS,CAAC,CAAC;AACnC,SAAG,YAAY,EAAI,CAAA,MAAK,CAAE,aAAY,CAAC,CAAC;AACxC,SAAG,KAAK,EAAI,CAAA,WAAU,AAAC,CAAC,IAAG,UAAU,CAAC,CAAC;AACvC,AAAI,QAAA,CAAA,WAAU,EAAI,CAAA,IAAG,UAAU,CAAE,IAAG,UAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AAC3D,SAAG,SAAS,EAAI,EAAC,CAAC,WAAU,WAAa,oBAAkB,CAAC,CAAC;IACjE;AAAA,AACA,iBAAa,UAAU,UAAU,EAAI,UAAU,gBAAe,CAAG;AAC7D,AAAI,QAAA,CAAA,WAAU,EAAI,iBAAe,CAAC;AAClC,AAAI,QAAA,CAAA,cAAa,CAAC;AAClB,AAAI,QAAA,CAAA,gBAAe,EAAI,GAAC,CAAC;AACzB,AAAI,QAAA,CAAA,QAAO,EAAI,GAAC,CAAC;AACjB,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,UAAU,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC/C,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,IAAG,UAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,qBAAa,EAAI,YAAU,CAAC;AAC5B,WAAI,OAAM,WAAa,oBAAkB,CAAG;AACxC,eAAK;QACT;AAAA,AACA,WAAI,MAAK,UAAU,AAAC,CAAC,cAAa,CAAC,CAAG;AAClC,iBAAO,KAAK,AAAC,CAAC,cAAa,KAAK,CAAC,CAAC;AAElC,aAAI,OAAM,WAAa,YAAU,CAAG;AAChC,2BAAe,CAAE,OAAM,KAAK,CAAC,EAAI,CAAA,cAAa,SAAS,AAAC,EAAC,CAAC;AAC1D,sBAAU,EAAI,KAAG,CAAC;AAClB,iBAAK;UACT;AAAA,AACA,aAAI,OAAM,WAAa,eAAa,CAAG;AACnC,2BAAe,CAAE,OAAM,KAAK,CAAC,EAAI,CAAA,cAAa,KAAK,CAAC;UACxD,KACK,KAAI,CAAC,OAAM,MAAM,AAAC,CAAC,cAAa,KAAK,CAAC,CAAG;AAC1C,iBAAO,KAAG,CAAC;UACf;AAAA,AACA,oBAAU,EAAI,CAAA,cAAa,MAAM,CAAC;QACtC,KACK,KAAI,CAAC,OAAM,MAAM,AAAC,CAAC,EAAC,CAAC,CAAG;AACzB,eAAO,KAAG,CAAC;QACf;AAAA,MACJ;AAAA,AACA,SAAI,IAAG,SAAS,GAAK,CAAA,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAChD,aAAO,KAAG,CAAC;MACf;AAAA,AACI,QAAA,CAAA,OAAM,EAAI,CAAA,QAAO,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;AAChC,AAAI,QAAA,CAAA,SAAQ,CAAC;AACb,AAAI,QAAA,CAAA,WAAU,CAAC;AACf,AAAI,QAAA,CAAA,SAAQ,CAAC;AACb,AAAI,QAAA,CAAA,SAAQ,CAAC;AACb,SAAI,MAAK,UAAU,AAAC,CAAC,cAAa,CAAC,CAAG;AAElC,AAAI,UAAA,CAAA,aAAY,EAAI,CAAA,gBAAe,WAAa,CAAA,YAAW,QAAQ,CAAA,CAAI,iBAAe,EAAI,eAAa,CAAC;AACxG,gBAAQ,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,aAAY,OAAO,CAAC,CAAA,CAC7C,CAAA,YAAW,iBAAiB,MAAM,AAAC,CAAC,aAAY,OAAO,CAAG,iBAAe,CAAC,CAAA,CAC1E,iBAAe,CAAC;AACpB,gBAAQ,EAAI,CAAA,YAAW,gBAAgB,AAAC,CAAC,aAAY,OAAO,CAAC,CAAC;AAC9D,gBAAQ,EAAI,CAAA,cAAa,UAAU,CAAC;MACxC,KACK;AACD,gBAAQ,EAAI,iBAAe,CAAC;AAC5B,gBAAQ,EAAI,GAAC,CAAC;AACd,gBAAQ,EAAI,GAAC,CAAC;MAClB;AAAA,AACA,gBAAU,EAAI,CAAA,IAAG,gBAAgB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAG,KAAG,CAAG,UAAQ,CAAC,CAAC;AACvE,WAAO,IAAI,UAAQ,AAAC,CAAC,WAAU,CAAG,YAAU,CAAG,UAAQ,CAAC,CAAC;IAC7D,CAAC;AACD,iBAAa,UAAU,SAAS,EAAI,UAAU,MAAK,CAAG;AAClD,AAAI,QAAA,CAAA,WAAU,EAAI,IAAI,SAAO,AAAC,CAAC,MAAK,CAAC,CAAC;AACtC,AAAI,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,UAAU,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAC5C,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,IAAG,UAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,WAAI,CAAC,CAAC,OAAM,WAAa,oBAAkB,CAAC,CAAG;AAC3C,aAAG,KAAK,AAAC,CAAC,OAAM,SAAS,AAAC,CAAC,WAAU,CAAC,CAAC,CAAC;QAC5C;AAAA,MACJ;AAAA,AACI,QAAA,CAAA,OAAM,EAAI,CAAA,IAAG,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;AAC5B,AAAI,QAAA,CAAA,mBAAkB,EAAI,CAAA,WAAU,UAAU,AAAC,EAAC,CAAC;AACjD,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,YAAW,gBAAgB,AAAC,CAAC,mBAAkB,CAAC,CAAC;AACjE,WAAO,CAAA,IAAG,gBAAgB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAG,KAAG,CAAG,OAAK,CAAC,CAAC;IACjE,CAAC;AACD,iBAAa,UAAU,gBAAgB,EAAI,UAAU,OAAM,CAAG,CAAA,SAAQ,CAAG,CAAA,WAAU,CAAG,CAAA,MAAK,CAAG;AAC1F,AAAI,QAAA,CAAA,OAAM,EAAI,CAAA,OAAM,EAAI,IAAE,CAAA,CAAI,CAAA,SAAQ,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;AACjD,SAAI,IAAG,OAAO,IAAI,AAAC,CAAC,OAAM,CAAC,CAAG;AAC1B,aAAO,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,OAAM,CAAC,CAAC;MACnC;AAAA,AACI,QAAA,CAAA,WAAU,EAAI,IAAI,CAAA,aAAY,qBAAqB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAG,YAAU,CAAG,OAAK,CAAC,CAAC;AACjG,SAAG,OAAO,IAAI,AAAC,CAAC,OAAM,CAAG,YAAU,CAAC,CAAC;AACrC,WAAO,YAAU,CAAC;IACtB,CAAC;AACD,SAAO,eAAa,CAAC;EACzB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,eAAe,EAAI,eAAa,CAAC;AAzQvC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAyQuB;AC1Q1C,KAAK,SAAS,AAAC,CAAC,4CAA2C,CAAG,EAAC,4CAA2C,CAAE,gCAA8B,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA1N,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAAyB,CAAC,CAAC;AAClE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAIjE,SAAS,qBAAmB,CAAE,MAAK,CAAG;AAClC,OAAI,MAAK,WAAa,CAAA,wBAAuB,MAAM,CAAA,EAAK,CAAA,MAAK,WAAa,CAAA,wBAAuB,SAAS,CAAA,EAAK,CAAA,MAAK,WAAa,CAAA,wBAAuB,WAAW,CAAA,EAC/J,CAAA,MAAK,WAAa,CAAA,wBAAuB,SAAS,CAAG;AACrD,WAAO,OAAK,CAAC;IACjB;AAAA,AACA,OAAI,CAAC,CAAC,MAAK,UAAU,CAAC,GAAK,EAAC,CAAC,MAAK,WAAW,CAAC,CAAG;AAC7C,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,gGAA+F,CAAC,CAAC;IAC1I;AAAA,AACA,OAAI,MAAK,UAAU,CAAG;AAClB,SAAI,MAAO,OAAK,UAAU,CAAA,EAAK,SAAO,CAAG;AACrC,AAAI,UAAA,CAAA,yBAAwB,EAAI,CAAA,MAAK,UAAU,CAAC;AAChD,WAAI,yBAAwB,KAAK,GAAK,cAAY,CAAG;AACjD,eAAO,IAAI,CAAA,wBAAuB,MAAM,AAAC,CAAC;AACtC,eAAG,CAAG,CAAA,MAAK,KAAK;AAChB,oBAAQ,CAAG,CAAA,yBAAwB,YAAY;AAC/C,aAAC,CAAG,CAAA,MAAK,GAAG;AAAA,UAChB,CAAC,CAAC;QACN,KACK,KAAI,yBAAwB,KAAK,GAAK,SAAO,CAAG;AACjD,eAAO,IAAI,CAAA,wBAAuB,WAAW,AAAC,CAAC;AAAE,eAAG,CAAG,CAAA,MAAK,KAAK;AAAG,iBAAK,CAAG,CAAA,yBAAwB,OAAO;AAAG,aAAC,CAAG,CAAA,MAAK,GAAG;AAAA,UAAE,CAAC,CAAC;QAClI,KACK;AACD,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,2BAA0B,EAAI,CAAA,yBAAwB,KAAK,CAAA,CAAI,sDAAoD,CAAC,CAAC;QAC9J;AAAA,MACJ;AAAA,AACA,WAAO,IAAI,CAAA,wBAAuB,MAAM,AAAC,CAAC,MAAK,CAAC,CAAC;IACrD;AAAA,AACA,OAAI,MAAK,WAAW,CAAG;AACnB,WAAO,IAAI,CAAA,wBAAuB,SAAS,AAAC,CAAC;AAAE,WAAG,CAAG,CAAA,MAAK,KAAK;AAAG,iBAAS,CAAG,CAAA,MAAK,WAAW;AAAA,MAAE,CAAC,CAAC;IACtG;AAAA,AACA,SAAO,OAAK,CAAC;EACjB;AAAA,AACA,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AACnD,SAAS,sBAAoB,CAAE,SAAQ,CAAG,CAAA,IAAG,CAAG;AAC5C,OAAI,CAAC,MAAK,OAAO,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC3B,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,wBAAuB,EAAI,KAAG,CAAA,CAAI,wCAAsC,CAAC,CAAC;IACnH;AAAA,EACJ;AAAA,AACA,QAAM,sBAAsB,EAAI,sBAAoB,CAAC;AA5CrD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA4C8B;AC7CjD,KAAK,SAAS,AAAC,CAAC,+CAA8C,CAAG,EAAC,+BAA8B,CAAE,iDAA+C,CAAE,0CAAwC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAArO,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,4BAA2B,EAAI,CAAA,OAAM,AAAC,CAAC,gDAA6B,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACrE,SAAS,iBAAe,CAAE,CAAA,CAAG,CAAA,IAAG,CAAG;AAC/B,OAAI,CAAC,CAAC,IAAG,WAAa,CAAA,MAAK,KAAK,CAAC;AAC7B,WAAO,MAAI,CAAC;AAAA,AAChB,SAAO,CAAA,CAAA,KAAK,GAAK,CAAA,IAAG,UAAU,CAAC;EACnC;AAAA,AACA,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AAC3C,SAAS,mBAAiB,CAAE,IAAG,CAAG;AAC9B,AAAI,MAAA,CAAA,WAAU,EAAI,CAAA,YAAW,UAAU,YAAY,AAAC,CAAC,IAAG,CAAC,CAAC;AAC1D,QAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC5C,AAAI,QAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,SAAI,UAAS,WAAa,CAAA,4BAA2B,YAAY,CAAG;AAChE,aAAO,CAAA,UAAS,GAAG,CAAC;MACxB;AAAA,IACJ;AAAA,AACA,SAAO,KAAG,CAAC;EACf;AAAA,AACA,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAnB/C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAmBiC;ACpBpD,KAAK,SAAS,AAAC,CAAC,iCAAgC,CAAG,EAAC,4BAA2B,CAAE,6BAA2B,CAAE,+BAA6B,CAAE,kCAAgC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAvN,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAiB,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAS,CAAC,CAAC;AAClC,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,8BAAW,CAAC,CAAC;AACtC,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAc,CAAC,CAAC;AA8B5C,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC1B,WAAS,WAAS,CAAE,OAAM,CAAG,CAAA,SAAQ,CAAG;AACpC,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,UAAU,EAAI,UAAQ,CAAC;IAC9B;AAAA,AACA,SAAK,eAAe,AAAC,CAAC,UAAS,UAAU,CAAG,gBAAc,CAAG;AACzD,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,QAAQ,cAAc,AAAC,CAAC,IAAG,uBAAuB,CAAC,CAAC;MAAE;AACnF,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,UAAS,UAAU,CAAG,cAAY,CAAG;AACvD,QAAE,CAAG,UAAU,OAAM,CAAG;AACpB,WAAG,aAAa,EAAI,QAAM,CAAC;AAC3B,WAAG,uBAAuB,EAAI,CAAA,IAAG,QAAQ,SAAS,AAAC,CAAC,IAAG,aAAa,CAAC,CAAC;AAEtE,AAAI,UAAA,CAAA,cAAa,EAAI,CAAA,GAAE,EAAI,CAAA,aAAY,qBAAqB,AAAC,CAAC,IAAG,uBAAuB,CAAC,CAAC;AAC1F,WAAG,YAAY,EAAI,CAAA,IAAG,UAAU,oBAAoB,AAAC,CAAC,cAAa,CAAC,CAAC;MACzE;AACA,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,aAAS,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AACvC,SAAG,QAAQ,sBAAsB,AAAC,CAAC,IAAG,uBAAuB,CAAC,CAAC;AAC/D,WAAO,MAAI,CAAC;IAChB,CAAC;AACD,aAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,UAAS,UAAU,AAAC,CAAC;AACjB,aAAO,CAAG,gBAAc;AACxB,eAAS,CAAG,EAAC,yBAAwB,CAAC;AACtC,SAAG,CAAG;AACF,gBAAQ,CAAG,YAAU;AACrB,oBAAY,CAAG,cAAY;AAC3B,mCAA2B,CAAG,gBAAc;AAAA,MAChD;AAAA,IACJ,CAAC,CACD,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,OAAO,CAAG,CAAA,UAAS,SAAS,CAAC,CAAC,CAC1E,CAAG,WAAS,CAAC,CAAC;AACd,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,WAAW,EAAI,WAAS,CAAC;AAnF/B,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAmFmB;ACpFtC,KAAK,SAAS,AAAC,CAAC,sCAAqC,CAAG,EAAC,+BAA8B,CAAE,sCAAoC,CAAE,sCAAoC,CAAE,sCAAoC,CAAE,wCAAsC,CAAE,0CAAwC,CAAE,yCAAuC,CAAE,iCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA/Y,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,iBAAgB,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAkB,CAAC,CAAC;AACpD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AACxD,AAAI,IAAA,CAAA,qBAAoB,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAsB,CAAC,CAAC;AAC5D,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,wCAAqB,CAAC,CAAC;AAC1D,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,gCAAa,CAAC,CAAC;AAM1C,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC/B,WAAS,gBAAc,CAAC,AAAC,CAAE;AACvB,SAAG,MAAM,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACnC,SAAG,UAAU,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAEvC,SAAG,SAAS,EAAI,GAAC,CAAC;AAElB,SAAG,UAAU,EAAI,GAAC,CAAC;IACvB;AAAA,AACA,kBAAc,UAAU,OAAO,EAAI,UAAU,MAAK,CAAG;AACjD,AAAI,QAAA,CAAA,OAAM,CAAC;AACX,SAAI,MAAK,UAAU,AAAC,CAAC,MAAK,GAAG,CAAC,CAAA,EAAK,CAAA,MAAK,GAAG,CAAE,CAAA,CAAC,YAAY,AAAC,EAAC,CAAA,EAAK,CAAA,MAAK,GAAG,CAAE,CAAA,CAAC,CAAG;AAC3E,AAAI,UAAA,CAAA,cAAa,EAAI,CAAA,MAAK,GAAG,CAAE,CAAA,CAAC,YAAY,AAAC,EAAC,CAAA,CAAI,CAAA,MAAK,GAAG,UAAU,AAAC,CAAC,CAAA,CAAC,CAAC;AACxE,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,CAAA,MAAK,KAAK,CAAA,CAAI,iBAAe,CAAA,CAAI,CAAA,MAAK,GAAG,CAAA,CAAI,sFAAoF,CAAA,CAAI,eAAa,CAAA,CAAI,KAAG,CAAC,CAAC;MAChN;AAAA,AACA,SAAI,MAAK,WAAa,CAAA,mBAAkB,SAAS,CAAG;AAChD,cAAM,EAAI,IAAI,CAAA,oBAAmB,iBAAiB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;AAClF,AAAI,UAAA,CAAA,IAAG,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,MAAK,KAAK,CAAG,IAAE,CAAC,CAAA,CAAI,CAAA,MAAK,KAAK,UAAU,AAAC,CAAC,CAAA,CAAC,CAAA,CAAI,CAAA,MAAK,KAAK,CAAC;AACrG,AAAI,UAAA,CAAA,UAAS,EAAI,IAAI,CAAA,iBAAgB,eAAe,AAAC,CAAC,MAAK,KAAK,CAAG,QAAM,CAAC,CAAC;AAC3E,WAAG,UAAU,IAAI,AAAC,CAAC,IAAG,CAAG,WAAS,CAAC,CAAC;AACpC,aAAO,CAAA,UAAS,SAAS,CAAC;MAC9B;AAAA,AACA,SAAI,MAAK,WAAa,CAAA,mBAAkB,SAAS,CAAG;AAChD,WAAG,UAAU,KAAK,AAAC,CAAC,GAAI,WAAS,AAAC,CAAC,MAAK,KAAK,CAAG,CAAA,MAAK,WAAW,CAAC,CAAC,CAAC;AACnE,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,MAAK,WAAa,CAAA,mBAAkB,MAAM,CAAG;AAC7C,cAAM,EAAI,IAAI,CAAA,oBAAmB,iBAAiB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;MACtF,KACK,KAAI,MAAK,WAAa,CAAA,mBAAkB,WAAW,CAAG;AACvD,cAAM,EAAI,IAAI,CAAA,qBAAoB,kBAAkB,AAAC,CAAC,MAAK,OAAO,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;MACrF;AAAA,AACI,QAAA,CAAA,UAAS,EAAI,IAAI,CAAA,iBAAgB,eAAe,AAAC,CAAC,MAAK,KAAK,CAAG,QAAM,CAAC,CAAC;AAC3E,SAAG,SAAS,QAAQ,AAAC,CAAC,SAAU,OAAM,CAAG;AACrC,WAAI,UAAS,KAAK,GAAK,CAAA,OAAM,KAAK,CAAG;AACjC,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,iBAAgB,EAAI,CAAA,MAAK,KAAK,CAAA,CAAI,oCAAkC,CAAA,CAAI,CAAA,OAAM,KAAK,CAAA,CAAI,IAAE,CAAC,CAAC;QACpI;AAAA,MACJ,CAAC,CAAC;AACF,SAAG,SAAS,KAAK,AAAC,CAAC,UAAS,CAAC,CAAC;AAC9B,SAAI,MAAK,UAAU,AAAC,CAAC,MAAK,GAAG,CAAC,CAAG;AAC7B,WAAG,MAAM,IAAI,AAAC,CAAC,MAAK,GAAG,CAAG,WAAS,CAAC,CAAC;MACzC;AAAA,AACA,WAAO,CAAA,UAAS,SAAS,CAAC;IAC9B,CAAC;AAKD,kBAAc,UAAU,UAAU,EAAI,UAAU,QAAO,CAAG;AACtD,AAAI,QAAA,CAAA,SAAQ,EAAI,GAAC,CAAC;AAClB,aAAO,EAAI,CAAA,IAAG,UAAU,AAAC,CAAC,QAAO,CAAC,CAAC;AACnC,SAAG,SAAS,QAAQ,AAAC,CAAC,SAAU,cAAa,CAAG;AAC5C,AAAI,UAAA,CAAA,SAAQ,EAAI,CAAA,cAAa,UAAU,AAAC,CAAC,QAAO,CAAC,CAAC;AAClD,WAAI,MAAK,UAAU,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC7B,kBAAQ,KAAK,AAAC,CAAC,SAAQ,CAAC,CAAC;QAC7B;AAAA,MACJ,CAAC,CAAC;AACF,WAAO,UAAQ,CAAC;IACpB,CAAC;AACD,kBAAc,UAAU,UAAU,EAAI,UAAU,QAAO,CAAG;AACtD,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,UAAU,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC/C,AAAI,UAAA,CAAA,UAAS,EAAI,CAAA,IAAG,UAAU,CAAE,CAAA,CAAC,CAAC;AAClC,AAAI,UAAA,CAAA,aAAY,EAAI,CAAA,UAAS,SAAS,AAAC,CAAC,QAAO,CAAC,CAAC;AACjD,WAAI,MAAK,UAAU,AAAC,CAAC,aAAY,CAAC,CAAG;AACjC,eAAO,cAAY,CAAC;QACxB;AAAA,MACJ;AAAA,AACA,WAAO,SAAO,CAAC;IACnB,CAAC;AACD,kBAAc,UAAU,mBAAmB,EAAI,UAAU,QAAO,CAAG;AAC/D,AAAI,QAAA,CAAA,cAAa,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,QAAO,KAAK,CAAC,CAAC;AACtD,SAAI,MAAK,QAAQ,AAAC,CAAC,cAAa,CAAC,CAAG;AAChC,aAAO,KAAG,CAAC;MACf;AAAA,AACA,WAAO,CAAA,cAAa,UAAU,AAAC,CAAC,QAAO,CAAC,CAAC;IAC7C,CAAC;AACD,kBAAc,UAAU,SAAS,EAAI,UAAU,IAAG,CAAG;AAAE,WAAO,CAAA,IAAG,MAAM,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;IAAE,CAAC;AACrF,kBAAc,UAAU,SAAS,EAAI,UAAU,IAAG,CAAG,CAAA,MAAK,CAAG;AACzD,AAAI,QAAA,CAAA,cAAa,EAAI,CAAA,IAAG,MAAM,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AACzC,SAAI,MAAK,QAAQ,AAAC,CAAC,cAAa,CAAC,CAAG;AAChC,aAAO,KAAG,CAAC;MACf;AAAA,AACA,WAAO,CAAA,cAAa,SAAS,AAAC,CAAC,MAAK,CAAC,CAAC;IAC1C,CAAC;AACD,SAAO,gBAAc,CAAC;EAC1B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,gBAAgB,EAAI,gBAAc,CAAC;AACzC,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC1B,WAAS,WAAS,CAAE,IAAG,CAAG,CAAA,UAAS,CAAG;AAClC,SAAG,SAAS,EAAI,GAAC,CAAC;AAClB,SAAG,WAAW,EAAI,GAAC,CAAC;AACpB,SAAI,MAAK,cAAc,WAAW,AAAC,CAAC,IAAG,CAAG,IAAE,CAAC,CAAG;AAC5C,WAAG,EAAI,CAAA,IAAG,UAAU,AAAC,CAAC,CAAA,CAAC,CAAC;MAC5B;AAAA,AACA,SAAG,SAAS,EAAI,CAAA,IAAG,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;AAC/B,SAAI,MAAK,cAAc,WAAW,AAAC,CAAC,UAAS,CAAG,IAAE,CAAC,CAAG;AAClD,iBAAS,EAAI,CAAA,UAAS,UAAU,AAAC,CAAC,CAAA,CAAC,CAAC;MACxC;AAAA,AACA,SAAG,WAAW,EAAI,CAAA,UAAS,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;IAC3C;AAAA,AAIA,aAAS,UAAU,SAAS,EAAI,UAAU,QAAO,CAAG;AAChD,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,SAAS,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC9C,WAAI,MAAK,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAG;AAC1B,eAAO,KAAG,CAAC;QACf;AAAA,AACI,UAAA,CAAA,OAAM,EAAI,CAAA,IAAG,SAAS,CAAE,CAAA,CAAC,CAAC;AAC9B,WAAI,OAAM,GAAK,CAAA,QAAO,KAAK,CAAG;AAC1B,eAAO,KAAG,CAAC;QACf;AAAA,AACA,eAAO,EAAI,CAAA,QAAO,MAAM,CAAC;MAC7B;AAAA,AACA,UAAS,GAAA,CAAA,CAAA,EAAI,CAAA,IAAG,WAAW,OAAO,EAAI,EAAA,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AACrD,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,IAAG,WAAW,CAAE,CAAA,CAAC,CAAC;AAChC,eAAO,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,CAAC,OAAM,CAAG,SAAO,CAAC,CAAC;MACtD;AAAA,AACA,WAAO,SAAO,CAAC;IACnB,CAAC;AACD,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,WAAW,EAAI,WAAS,CAAC;AAvI/B,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAuIwB;ACxI3C,KAAK,SAAS,AAAC,CAAC,oCAAmC,CAAG,EAAC,sCAAqC,CAAE,kCAAgC,CAAE,sCAAoC,CAAE,iCAA+B,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,wCAAsC,CAAE,0CAAwC,CAAE,uBAAqB,CAAE,6CAA2C,CAAE,iCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA5e,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,OAAM,AAAC,CAAC,sCAAmB,CAAC,CAAC;AACtD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAc,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAoB,CAAC,CAAC;AACxD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACrE,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAAyB,CAAC,CAAC;AAClE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,gCAAa,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AAMzD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC7B,WAAS,cAAY,CAAC,AAAC,CAAE;AACrB,SAAG,OAAO,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;IACxC;AAAA,AAIA,gBAAY,UAAU,OAAO,EAAI,UAAU,eAAc,CAAG,CAAA,MAAK,CAAG;AAChE,WAAK,EAAI,CAAA,wBAAuB,qBAAqB,AAAC,CAAC,MAAK,CAAC,CAAC;AAE9D,SAAI,MAAK,WAAa,CAAA,mBAAkB,MAAM,CAAG;AAC7C,+BAAuB,sBAAsB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;MACjF,KACK,KAAI,MAAK,WAAa,CAAA,mBAAkB,SAAS,CAAG;AACrD,+BAAuB,sBAAsB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;MACjF;AAAA,AACI,QAAA,CAAA,UAAS,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AACjD,SAAI,MAAK,QAAQ,AAAC,CAAC,UAAS,CAAC,CAAG;AAC5B,iBAAS,EAAI,IAAI,CAAA,kBAAiB,gBAAgB,AAAC,EAAC,CAAC;AACrD,WAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAG,WAAS,CAAC,CAAC;MAChD;AAAA,AACI,QAAA,CAAA,QAAO,EAAI,CAAA,UAAS,OAAO,AAAC,CAAC,MAAK,CAAC,CAAC;AACxC,SAAI,MAAK,WAAa,CAAA,mBAAkB,MAAM,CAAG;AAC7C,WAAI,QAAO,CAAG;AACV,gCAAsB,AAAC,CAAC,MAAK,UAAU,CAAG,CAAA,MAAK,KAAK,CAAC,CAAC;QAC1D,KACK;AACD,aAAG,oBAAoB,AAAC,CAAC,MAAK,UAAU,CAAC,CAAC;QAC9C;AAAA,MACJ;AAAA,IACJ,CAAC;AAID,gBAAY,UAAU,oBAAoB,EAAI,UAAU,SAAQ,CAAG;AAC/D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,CAAC,MAAK,OAAO,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC3B,eAAM;MACV;AAAA,AAGA,SAAI,IAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC5B,eAAM;MACV;AAAA,AACI,QAAA,CAAA,WAAU,EAAI,CAAA,YAAW,UAAU,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC;AAC/D,SAAI,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC/B,YAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACzC,AAAI,YAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,aAAI,UAAS,WAAa,CAAA,mBAAkB,YAAY,CAAG;AACvD,uBAAW,YAAY,QAAQ,AAAC,CAAC,UAAS,QAAQ,CAAG,UAAU,MAAK,CAAG;AAAE,mBAAO,CAAA,KAAI,OAAO,AAAC,CAAC,SAAQ,CAAG,OAAK,CAAC,CAAC;YAAE,CAAC,CAAC;UACvH;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAKD,gBAAY,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG,CAAA,eAAc,CAAG;AAChE,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,YAAW,OAAO,MAAM,AAAC,CAAC,GAAE,CAAC,CAAC;AAC9C,WAAO,CAAA,IAAG,WAAW,AAAC,CAAC,SAAQ,CAAG,gBAAc,CAAC,CAAC;IACtD,CAAC;AACD,gBAAY,UAAU,WAAW,EAAI,UAAU,SAAQ,CAAG,CAAA,eAAc,CAAG;AACvE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,WAAO,CAAA,IAAG,uBAAuB,AAAC,CAAC,SAAQ,CAAG,gBAAc,CAAC,KACrD,AAAC,CAAC,SAAU,WAAU,CAAG;AAC7B,aAAO,CAAA,KAAI,+BAA+B,AAAC,CAAC,WAAU,CAAG,gBAAc,CAAC,CAAC;MAC7E,CAAC,CAAC;IACN,CAAC;AACD,gBAAY,UAAU,uBAAuB,EAAI,UAAU,SAAQ,CAAG,CAAA,eAAc,CAAG;AACnF,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,SAAI,MAAK,QAAQ,AAAC,CAAC,mBAAkB,CAAC,CAAG;AACrC,aAAO,eAAa,CAAC;MACzB;AAAA,AAEI,QAAA,CAAA,eAAc,EAAI,CAAA,mBAAkB,UAAU,AAAC,CAAC,SAAQ,CAAC,CAAC;AAC9D,AAAI,QAAA,CAAA,aAAY,EAAI,CAAA,YAAW,YAAY,IAAI,AAAC,CAAC,eAAc,CAAG,UAAU,SAAQ,CAAG;AAAE,aAAO,CAAA,KAAI,2BAA2B,AAAC,CAAC,SAAQ,CAAC,CAAC;MAAE,CAAC,CAAC;AAC/I,WAAO,CAAA,OAAM,eAAe,IAAI,AAAC,CAAC,aAAY,CAAC,KAAK,AAAC,CAAC,YAAW,CAAC,CAAC;IACvE,CAAC;AACD,gBAAY,UAAU,2BAA2B,EAAI,UAAU,YAAW,CAAG;AACzE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,WAAU,EAAI,CAAA,YAAW,YAAY,CAAC;AAC1C,WAAO,CAAA,WAAU,qBAAqB,AAAC,EAAC,KAAK,AAAC,CAAC,SAAU,aAAY,CAAG;AACpE,YAAI,oBAAoB,AAAC,CAAC,aAAY,CAAC,CAAC;AACxC,WAAI,WAAU,SAAS,CAAG;AACtB,eAAO,IAAI,CAAA,aAAY,mBAAmB,AAAC,CAAC,WAAU,CAAG,KAAG,CAAG,CAAA,YAAW,aAAa,CAAC,CAAC;QAC7F;AAAA,AACA,aAAO,CAAA,KAAI,uBAAuB,AAAC,CAAC,YAAW,UAAU,CAAG,cAAY,CAAC,KACjE,AAAC,CAAC,SAAU,gBAAe,CAAG;AAClC,aAAI,MAAK,QAAQ,AAAC,CAAC,gBAAe,CAAC,CAAG;AAClC,iBAAO,KAAG,CAAC;UACf,KACK;AACD,iBAAO,IAAI,CAAA,aAAY,mBAAmB,AAAC,CAAC,WAAU,CAAG,iBAAe,CAAG,CAAA,YAAW,aAAa,CAAC,CAAC;UACzG;AAAA,QACJ,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;AACD,gBAAY,UAAU,+BAA+B,EAAI,UAAU,WAAU,CAAG,CAAA,eAAc,CAAG;AAC7F,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AAC7B,aAAO,eAAa,CAAC;MACzB;AAAA,AACI,QAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,AAAI,QAAA,CAAA,eAAc,EAAI,GAAC,CAAC;AACxB,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,WAAU,QAAQ,IAAI,AAAC,CAAC,SAAU,UAAS,CAAG;AACzD,AAAI,UAAA,CAAA,KAAI,EAAI,CAAA,mBAAkB,mBAAmB,AAAC,CAAC,UAAS,CAAC,CAAC;AAC9D,WAAI,MAAK,QAAQ,AAAC,CAAC,KAAI,CAAC,CAAG;AACvB,eAAO,eAAa,CAAC;QACzB;AAAA,AACA,aAAO,CAAA,KAAI,2BAA2B,AAAC,CAAC,KAAI,CAAC,KAAK,AAAC,CAAC,SAAU,cAAa,CAAG;AAC1E,aAAI,MAAK,UAAU,AAAC,CAAC,cAAa,CAAC,CAAG;AAClC,iBAAO,CAAA,KAAI,+BAA+B,AAAC,CAAC,cAAa,CAAG,gBAAc,CAAC,KACnE,AAAC,CAAC,SAAU,gBAAe,CAAG;AAClC,4BAAc,CAAE,UAAS,KAAK,CAAC,EAAI,iBAAe,CAAC;YACvD,CAAC,CAAC;UACN;AAAA,QACJ,CAAC,CAAC;MACN,CAAC,CAAC;AACF,WAAO,CAAA,OAAM,eAAe,IAAI,AAAC,CAAC,QAAO,CAAC,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAC1D,WAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AACnC,eAAO,IAAI,CAAA,aAAY,YAAY,AAAC,CAAC,WAAU,UAAU,CAAG,KAAG,CAAG,gBAAc,CAAC,CAAC;QACtF;AAAA,AACA,aAAO,CAAA,KAAI,+BAA+B,AAAC,CAAC,WAAU,MAAM,CAAG,CAAA,WAAU,UAAU,cAAc,CAAC,KAC1F,AAAC,CAAC,SAAU,aAAY,CAAG;AAC/B,eAAO,IAAI,CAAA,aAAY,YAAY,AAAC,CAAC,WAAU,UAAU,CAAG,cAAY,CAAG,gBAAc,CAAC,CAAC;QAC/F,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;AAKD,gBAAY,UAAU,SAAS,EAAI,UAAU,UAAS,CAAG,CAAA,eAAc,CAAG;AACtE,AAAI,QAAA,CAAA,QAAO,EAAI,GAAC,CAAC;AACjB,AAAI,QAAA,CAAA,eAAc,EAAI,gBAAc,CAAC;AACrC,AAAI,QAAA,CAAA,yBAAwB,EAAI,MAAI,CAAC;AACrC,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,UAAS,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC3C,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,UAAS,CAAE,CAAA,CAAC,CAAC;AAC3B,WAAI,MAAK,QAAQ,AAAC,CAAC,eAAc,CAAC,CAAG;AACjC,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,+BAA8B,EAAI,QAAM,CAAA,CAAI,MAAI,CAAC,CAAC;QAC3F;AAAA,AACA,WAAI,CAAC,MAAK,SAAS,AAAC,CAAC,OAAM,CAAC,CAAG;AAC3B,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,uBAAsB,EAAI,QAAM,CAAA,CAAI,qCAAmC,CAAC,CAAC;QAClH,KACK,KAAI,OAAM,GAAK,GAAC,CAAA,EAAK,CAAA,OAAM,GAAK,IAAE,CAAA,EAAK,CAAA,OAAM,GAAK,KAAG,CAAG;AACzD,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,IAAG,EAAI,QAAM,CAAA,CAAI,sDAAoD,CAAC,CAAC;QAChH;AAAA,AACI,UAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,WAAI,CAAA,EAAI,EAAA,CAAA,CAAI,CAAA,UAAS,OAAO,CAAG;AAC3B,AAAI,YAAA,CAAA,WAAU,EAAI,CAAA,UAAS,CAAE,CAAA,EAAI,EAAA,CAAC,CAAC;AACnC,aAAI,MAAK,YAAY,AAAC,CAAC,WAAU,CAAC,CAAG;AACjC,iBAAK,EAAI,YAAU,CAAC;AACpB,YAAA,GAAK,EAAA,CAAC;UACV;AAAA,QACJ;AAAA,AACI,UAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,WAAI,MAAK,QAAQ,AAAC,CAAC,mBAAkB,CAAC,CAAG;AACrC,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,cAAa,EAAI,CAAA,MAAK,wBAAwB,AAAC,CAAC,eAAc,CAAC,CAAA,CAAI,0BAAwB,CAAC,CAAC;QACtI;AAAA,AACI,UAAA,CAAA,QAAO,EAAI,CAAA,mBAAkB,SAAS,AAAC,CAAC,OAAM,CAAG,OAAK,CAAC,CAAC;AAC5D,WAAI,MAAK,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAG;AAC1B,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,cAAa,EAAI,CAAA,MAAK,wBAAwB,AAAC,CAAC,eAAc,CAAC,CAAA,CAAI,2BAAyB,CAAA,CAAI,QAAM,CAAA,CAAI,MAAI,CAAC,CAAC;QACzJ;AAAA,AACA,eAAO,KAAK,AAAC,CAAC,QAAO,CAAC,CAAC;AACvB,sBAAc,EAAI,CAAA,QAAO,cAAc,CAAC;AACxC,gCAAwB,EAAI,CAAA,QAAO,SAAS,CAAC;MACjD;AAAA,AACI,QAAA,CAAA,WAAU,EAAI,KAAG,CAAC;AACtB,SAAI,CAAC,yBAAwB,CAAG;AAC5B,kBAAU,EAAI,CAAA,IAAG,mBAAmB,AAAC,CAAC,eAAc,CAAC,CAAC;AACtD,WAAI,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC/B,AAAI,YAAA,CAAA,eAAc,EAAI,YAAU,CAAC;AACjC,gBAAO,MAAK,UAAU,AAAC,CAAC,eAAc,MAAM,CAAC,CAAG;AAC5C,0BAAc,EAAI,CAAA,eAAc,MAAM,CAAC;UAC3C;AAAA,AACA,kCAAwB,EAAI,CAAA,eAAc,UAAU,SAAS,CAAC;QAClE;AAAA,AACA,WAAI,MAAK,UAAU,AAAC,CAAC,eAAc,CAAC,CAAA,EAAK,EAAC,yBAAwB,CAAG;AACjE,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAI,0DAAwD,CAAC,CAAC;QAC7J;AAAA,MACJ;AAAA,AACA,YAAO,QAAO,OAAO,EAAI,EAAA,CAAG;AACxB,kBAAU,EAAI,IAAI,CAAA,aAAY,YAAY,AAAC,CAAC,QAAO,IAAI,AAAC,EAAC,CAAG,YAAU,CAAG,GAAC,CAAC,CAAC;MAChF;AAAA,AACA,WAAO,YAAU,CAAC;IACtB,CAAC;AAGD,gBAAY,UAAU,mBAAmB,EAAI,UAAU,eAAc,CAAG;AACpE,SAAI,MAAK,QAAQ,AAAC,CAAC,eAAc,CAAC,CAAG;AACjC,aAAO,KAAG,CAAC;MACf;AAAA,AACI,QAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,eAAc,CAAC,CAAC;AAC1D,SAAI,MAAK,QAAQ,AAAC,CAAC,mBAAkB,CAAC,CAAG;AACrC,aAAO,KAAG,CAAC;MACf;AAAA,AACA,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,mBAAkB,UAAU,OAAO,CAAG,CAAA,CAAA,GAAK,EAAA,CAAG;AAC9D,AAAI,UAAA,CAAA,QAAO,EAAI,CAAA,mBAAkB,UAAU,CAAE,CAAA,CAAC,CAAC;AAE/C,WAAI,QAAO,SAAS,OAAO,GAAK,EAAA,CAAA,EAAK,CAAA,QAAO,SAAS,CAAE,CAAA,CAAC,GAAK,GAAC,CAAG;AAC7D,AAAI,YAAA,CAAA,UAAS,EAAI,CAAA,YAAW,kBAAkB,AAAC,CAAC,QAAO,WAAW,CAAC,CAAC;AACpE,AAAI,YAAA,CAAA,OAAM,EAAI,CAAA,mBAAkB,UAAU,AAAC,CAAC,UAAS,CAAC,CAAC;AACvD,AAAI,YAAA,CAAA,kBAAiB,EAAI,CAAA,YAAW,YAAY,QAAQ,AAAC,CAAC,OAAM,CAAG,UAAU,KAAI,CAAG;AAAE,iBAAO,CAAA,KAAI,YAAY,YAAY,CAAC;UAAE,CAAC,CAAC;AAC9H,aAAI,MAAK,UAAU,AAAC,CAAC,kBAAiB,CAAC,CAAG;AACtC,AAAI,cAAA,CAAA,KAAI,EAAI,CAAA,IAAG,mBAAmB,AAAC,CAAC,kBAAiB,YAAY,cAAc,CAAC,CAAC;AACjF,iBAAO,IAAI,CAAA,aAAY,YAAY,AAAC,CAAC,kBAAiB,YAAY,CAAG,MAAI,CAAG,GAAC,CAAC,CAAC;UACnF;AAAA,AACA,eAAO,KAAG,CAAC;QACf;AAAA,MACJ;AAAA,AACA,WAAO,KAAG,CAAC;IACf,CAAC;AACD,gBAAY,EAAI,CAAA,UAAS,AAAC,CAAC,CACvB,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,cAAY,CAAC,CAAC;AACjB,SAAO,cAAY,CAAC;EACxB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,cAAc,EAAI,cAAY,CAAC;AAIrC,SAAS,aAAW,CAAE,YAAW,CAAG;AAChC,SAAO,CAAA,YAAW,YAAY,QAAQ,AAAC,CAAC,YAAW,CAAG,UAAU,WAAU,CAAG;AAAE,WAAO,CAAA,WAAU,UAAU,YAAY,CAAC;IAAE,CAAC,CAAC;EAC/H;AAAA,AACA,SAAS,wBAAsB,CAAE,SAAQ,CAAG,CAAA,IAAG,CAAG;AAC9C,OAAI,CAAC,MAAK,OAAO,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC3B,aAAM;IACV;AAAA,AACI,MAAA,CAAA,WAAU,EAAI,CAAA,YAAW,UAAU,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC;AAC/D,OAAI,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC/B,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,WAAU,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACzC,AAAI,UAAA,CAAA,UAAS,EAAI,CAAA,WAAU,CAAE,CAAA,CAAC,CAAC;AAC/B,WAAI,UAAS,WAAa,CAAA,mBAAkB,YAAY,CAAG;AACvD,cAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,qCAAoC,EAAI,KAAG,CAAA,CAAI,8CAA4C,CAAC,CAAC;QACtI;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AA5QA,AA4QA,OA5QK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA4QsB;AC7QzC,KAAK,SAAS,AAAC,CAAC,4BAA2B,CAAG,EAAC,gCAA+B,CAAE,sCAAoC,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,kCAAgC,CAAE,gDAA8C,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAtT,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAc,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,2BAA0B,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA4B,CAAC,CAAC;AACxE,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AACzD,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,KAAI,CAAC,CAAC;AAkB3D,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACtB,WAAS,OAAK,CAAE,QAAO,CAAG,CAAA,MAAK,CAAG,CAAA,aAAY,CAAG;AAC7C,SAAG,SAAS,EAAI,SAAO,CAAC;AACxB,SAAG,OAAO,EAAI,OAAK,CAAC;AACpB,SAAG,cAAc,EAAI,cAAY,CAAC;AAClC,SAAG,WAAW,EAAI,MAAI,CAAC;AACvB,SAAG,oBAAoB,EAAI,KAAG,CAAC;AAC/B,SAAG,mBAAmB,EAAI,eAAa,CAAC;AACxC,SAAG,QAAQ,EAAI,KAAG,CAAC;AACnB,SAAG,YAAY,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACzC,SAAG,SAAS,EAAI,IAAI,CAAA,OAAM,aAAa,AAAC,EAAC,CAAC;IAC9C;AAAA,AAKA,SAAK,UAAU,YAAY,EAAI,UAAU,aAAY,CAAG;AACpD,WAAO,CAAA,IAAG,aAAa,EAAI,IAAI,YAAU,AAAC,CAAC,IAAG,CAAG,cAAY,CAAC,CAAC;IACnE,CAAC;AAKD,SAAK,UAAU,UAAU,EAAI,UAAU,aAAY,CAAG;AAAE,WAAO,IAAI,YAAU,AAAC,CAAC,IAAG,CAAG,cAAY,CAAC,CAAC;IAAE,CAAC;AAMtG,SAAK,UAAU,sBAAsB,EAAI,UAAU,MAAK,CAAG;AACvD,SAAI,MAAK,UAAU,AAAC,CAAC,MAAK,KAAK,CAAC,CAAG;AAC/B,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,gEAA+D,CAAC,CAAC;MAC1G;AAAA,AACA,SAAG,QAAQ,EAAI,OAAK,CAAC;AACrB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAG;AAC5C,aAAO,CAAA,IAAG,OAAO,AAAC,CAAC,IAAG,oBAAoB,CAAG,MAAI,CAAC,CAAC;MACvD;AAAA,AACA,WAAO,eAAa,CAAC;IACzB,CAAC;AAMD,SAAK,UAAU,kBAAkB,EAAI,UAAU,MAAK,CAAG;AACnD,AAAI,QAAA,CAAA,UAAS,EAAI,CAAA,MAAK,KAAK,CAAC;AAC5B,SAAI,MAAK,QAAQ,AAAC,CAAC,UAAS,CAAC,CAAG;AAC5B,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,oEAAmE,CAAC,CAAC;MAC9G;AAAA,AAGI,QAAA,CAAA,MAAK,EAAI,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,cAAc,CAAC,CAAC;AAC/C,SAAG,YAAY,IAAI,AAAC,CAAC,UAAS,CAAG,OAAK,CAAC,CAAC;AACxC,WAAK,QAAQ,EAAI,OAAK,CAAC;AACvB,AAAI,QAAA,CAAA,cAAa,CAAC;AAClB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAA,EACzC,CAAA,MAAK,UAAU,AAAC,CAAC,cAAa,EAAI,CAAA,IAAG,oBAAoB,eAAe,CAAE,UAAS,CAAC,CAAC,CAAG;AACxF,aAAO,CAAA,MAAK,OAAO,AAAC,CAAC,cAAa,CAAC,CAAC;MACxC;AAAA,AACA,WAAO,eAAa,CAAC;IACzB,CAAC;AAKD,SAAK,UAAU,cAAc,EAAI,UAAU,WAAU,CAAG;AACpD,AAAI,QAAA,CAAA,MAAK,EAAI,KAAG,CAAC;AACjB,YAAO,MAAK,UAAU,AAAC,CAAC,MAAK,OAAO,CAAC,CAAA,EAAK,CAAA,MAAK,UAAU,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AAC3E,aAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AACtB,kBAAU,EAAI,CAAA,WAAU,MAAM,CAAC;MACnC;AAAA,AACA,WAAO,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAA,EAC5C,CAAA,IAAG,oBAAoB,UAAU,GAAK,CAAA,WAAU,UAAU,CAAC;IACnE,CAAC;AAaD,SAAK,UAAU,OAAO,EAAI,UAAU,WAAU,CAAG;AAC7C,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,gBAAU,QAAQ,AAAC,CAAC,SAAU,eAAc,CAAG;AAAE,YAAI,SAAS,OAAO,AAAC,CAAC,KAAI,cAAc,CAAG,gBAAc,CAAC,CAAC;MAAE,CAAC,CAAC;AAChH,WAAO,CAAA,IAAG,WAAW,AAAC,EAAC,CAAC;IAC5B,CAAC;AAaD,SAAK,UAAU,SAAS,EAAI,UAAU,UAAS,CAAG;AAC9C,AAAI,QAAA,CAAA,WAAU,EAAI,CAAA,IAAG,SAAS,AAAC,CAAC,UAAS,CAAC,CAAC;AAC3C,WAAO,CAAA,IAAG,sBAAsB,AAAC,CAAC,WAAU,CAAG,MAAI,CAAC,CAAC;IACzD,CAAC;AAQD,SAAK,UAAU,cAAc,EAAI,UAAU,GAAE,CAAG,CAAA,mBAAkB,CAAG;AACjE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AACnE,WAAO,CAAA,IAAG,mBAAmB,EAAI,CAAA,IAAG,mBAAmB,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AACvE,YAAI,sBAAsB,EAAI,IAAE,CAAC;AACjC,YAAI,iBAAiB,AAAC,EAAC,CAAC;AACxB,aAAO,CAAA,KAAI,8BAA8B,AAAC,CAAC,KAAI,UAAU,AAAC,CAAC,GAAE,CAAC,KAAK,AAAC,CAAC,SAAU,WAAU,CAAG;AACxF,aAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AAC7B,iBAAO,MAAI,CAAC;UAChB;AAAA,AACA,eAAO,CAAA,KAAI,UAAU,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;MACP,CAAC,CAAC;IACN,CAAC;AAKD,SAAK,UAAU,sBAAsB,EAAI,UAAU,WAAU,CAAG,CAAA,mBAAkB,CAAG;AACjF,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AACnE,SAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAG;AAC7B,aAAO,gBAAc,CAAC;MAC1B;AAAA,AACA,WAAO,CAAA,IAAG,mBAAmB,EAAI,CAAA,IAAG,mBAAmB,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AACvE,YAAI,iBAAiB,AAAC,EAAC,CAAC;AACxB,aAAO,CAAA,KAAI,8BAA8B,AAAC,CAAC,KAAI,UAAU,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,CAAC,CAAC;MACjG,CAAC,CAAC;IACN,CAAC;AACD,SAAK,UAAU,UAAU,EAAI,UAAU,WAAU,CAAG,CAAA,mBAAkB,CAAG;AACrE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,WAAO,CAAA,IAAG,mBAAmB,AAAC,CAAC,WAAU,CAAC,KAClC,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,aAAO,CAAA,KAAI,UAAU,AAAC,CAAC,WAAU,CAAC,CAAC;MAAE,CAAC,KACvD,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,aAAO,CAAA,KAAI,aAAa,AAAC,CAAC,WAAU,CAAC,CAAC;MAAE,CAAC,KAC1D,AAAC,CAAC,SAAU,MAAK,CAAG;AACxB,WAAI,CAAC,MAAK,CAAG;AACT,eAAO,MAAI,CAAC;QAChB;AAAA,AACA,aAAO,CAAA,KAAI,eAAe,AAAC,CAAC,WAAU,CAAC,KAC/B,AAAC,CAAC,SAAU,MAAK,CAAG;AACxB,aAAI,MAAK,CAAG;AACR,iBAAO,CAAA,KAAI,OAAO,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,KAC5C,AAAC,CAAC,SAAU,CAAA,CAAG;AACnB,kBAAI,sBAAsB,AAAC,CAAC,aAAY,qBAAqB,AAAC,CAAC,WAAU,CAAC,CAAC,CAAC;AAC5E,mBAAO,KAAG,CAAC;YACf,CAAC,CAAC;UACN;AAAA,QACJ,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC;AAMD,SAAK,UAAU,mBAAmB,EAAI,UAAU,WAAU,CAAG;AACzD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,qBAAoB,EAAI,GAAC,CAAC;AAC9B,SAAI,MAAK,QAAQ,AAAC,CAAC,WAAU,UAAU,cAAc,CAAC,CAAG;AACrD,4BAAoB,KAAK,AAAC,CAAC,WAAU,UAAU,qBAAqB,AAAC,EAAC,KAAK,AAAC,CAAC,SAAU,IAAG,CAAG;AAAE,cAAI,SAAS,oBAAoB,AAAC,CAAC,IAAG,CAAC,CAAC;QAAE,CAAC,CAAC,CAAC;MAChJ;AAAA,AACA,SAAI,MAAK,UAAU,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AACrC,4BAAoB,KAAK,AAAC,CAAC,IAAG,mBAAmB,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC,CAAC;MAC1E;AAAA,AACA,iBAAW,iBAAiB,QAAQ,AAAC,CAAC,WAAU,eAAe,CAAG,UAAU,WAAU,CAAG,CAAA,CAAA,CAAG;AACxF,4BAAoB,KAAK,AAAC,CAAC,KAAI,mBAAmB,AAAC,CAAC,WAAU,CAAC,CAAC,CAAC;MACrE,CAAC,CAAC;AACF,WAAO,CAAA,OAAM,eAAe,IAAI,AAAC,CAAC,qBAAoB,CAAC,CAAC;IAC5D,CAAC;AACD,SAAK,UAAU,sBAAsB,EAAI,UAAU,GAAE,CAAG;AAAE,YAAM,kBAAkB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,IAAE,CAAC,CAAC;IAAE,CAAC;AACnH,SAAK,UAAU,8BAA8B,EAAI,UAAU,OAAM,CAAG;AAChE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,WAAO,CAAA,OAAM,eAAe,WAAW,AAAC,CAAC,OAAM,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,aAAO,CAAA,KAAI,kBAAkB,AAAC,EAAC,CAAC;MAAE,CAAC,CAAG,UAAU,GAAE,CAAG;AACtH,YAAI,kBAAkB,AAAC,EAAC,CAAC;AACzB,YAAM,IAAE,CAAC;MACb,CAAC,CAAC;IACN,CAAC;AAID,SAAK,UAAU,UAAU,EAAI,UAAU,WAAU,CAAG;AAChD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AAC9B,aAAO,gBAAc,CAAC;MAC1B;AAAA,AACA,WAAO,CAAA,IAAG,QAAQ,SAAS,AAAC,CAAC,WAAU,UAAU,CAAC,KAC1C,AAAC,CAAC,SAAU,MAAK,CAAG;AACxB,kBAAU,UAAU,MAAM,EAAI,OAAK,CAAC;AACpC,WAAI,MAAK,GAAK,CAAA,MAAK,UAAU,AAAC,CAAC,KAAI,aAAa,CAAC,CAAA,EAAK,CAAA,MAAK,UAAU,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AACvF,eAAO,CAAA,KAAI,aAAa,UAAU,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC;QAC1D;AAAA,MACJ,CAAC,CAAC;IACN,CAAC;AACD,SAAK,UAAU,aAAa,EAAI,UAAU,eAAc,CAAG;AACvD,WAAO,CAAA,cAAa,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC;IACpE,CAAC;AACD,SAAK,UAAU,eAAe,EAAI,UAAU,WAAU,CAAG;AACrD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AAC9B,aAAO,eAAa,CAAC;MACzB;AAAA,AACI,QAAA,CAAA,IAAG,CAAC;AACR,AAAI,QAAA,CAAA,gBAAe,EAAI,KAAG,CAAC;AAC3B,AAAI,QAAA,CAAA,KAAI,EAAI,MAAI,CAAC;AACjB,AAAI,QAAA,CAAA,oBAAmB,EAAI,KAAG,CAAC;AAC/B,SAAI,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC/B,uBAAe,EAAI,CAAA,WAAU,MAAM,CAAC;AACpC,2BAAmB,EAAI,CAAA,WAAU,UAAU,CAAC;AAC5C,YAAI,EAAI,CAAA,WAAU,UAAU,MAAM,CAAC;MACvC;AAAA,AACA,SAAI,KAAI,CAAG;AACP,WAAG,EAAI,eAAa,CAAC;MACzB,KACK;AACD,WAAG,EAAI,CAAA,IAAG,QAAQ,cAAc,AAAC,CAAC,oBAAmB,CAAC,CAAC;MAC3D;AAAA,AAEA,WAAO,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,MAAK,CAAG;AAC/B,WAAI,MAAK,GAAK,MAAI,CAAG;AACjB,eAAO,MAAI,CAAC;QAChB;AAAA,AACA,WAAI,MAAK,UAAU,AAAC,CAAC,KAAI,aAAa,CAAC,CAAG;AACtC,eAAO,CAAA,KAAI,aAAa,eAAe,AAAC,CAAC,gBAAe,CAAC,CAAC;QAC9D;AAAA,AACA,aAAO,KAAG,CAAC;MACf,CAAC,CAAC;IACN,CAAC;AAID,SAAK,UAAU,OAAO,EAAI,UAAU,WAAU,CAAG,CAAA,mBAAkB,CAAG;AAClE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AACnE,SAAG,oBAAoB,EAAI,YAAU,CAAC;AACtC,AAAI,QAAA,CAAA,IAAG,EAAI,eAAa,CAAC;AACzB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AAChC,AAAI,UAAA,CAAA,oBAAmB,EAAI,CAAA,WAAU,UAAU,CAAC;AAChD,WAAI,oBAAmB,MAAM,CAAG;AAC5B,aAAG,EAAI,CAAA,IAAG,QAAQ,MAAM,AAAC,CAAC,oBAAmB,CAAC,CAAC;QACnD,KACK;AACD,aAAG,EACC,CAAA,IAAG,WAAW,AAAC,CAAC,WAAU,CAAC,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,iBAAO,CAAA,KAAI,QAAQ,SAAS,AAAC,CAAC,oBAAmB,CAAC,CAAC;UAAE,CAAC,CAAC;QAChH;AAAA,AACA,WAAI,MAAK,UAAU,AAAC,CAAC,WAAU,MAAM,CAAC,CAAG;AACrC,aAAG,EAAI,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAC1B,eAAI,MAAK,UAAU,AAAC,CAAC,KAAI,aAAa,CAAC,CAAG;AACtC,mBAAO,CAAA,KAAI,aAAa,OAAO,AAAC,CAAC,WAAU,MAAM,CAAC,CAAC;YACvD;AAAA,UACJ,CAAC,CAAC;QACN;AAAA,MACJ;AAAA,AACI,QAAA,CAAA,QAAO,EAAI,GAAC,CAAC;AACjB,iBAAW,WAAW,QAAQ,AAAC,CAAC,IAAG,YAAY,CAAG,UAAU,MAAK,CAAG,CAAA,IAAG,CAAG;AACtE,eAAO,KAAK,AAAC,CAAC,MAAK,OAAO,AAAC,CAAC,WAAU,eAAe,CAAE,IAAG,CAAC,CAAC,CAAC,CAAC;MAClE,CAAC,CAAC;AACF,WAAO,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,aAAO,CAAA,OAAM,eAAe,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;MAAE,CAAC,CAAC;IACnF,CAAC;AACD,SAAK,UAAU,iBAAiB,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,WAAW,EAAI,KAAG,CAAC;IAAE,CAAC;AAC3E,SAAK,UAAU,kBAAkB,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,WAAW,EAAI,MAAI,CAAC;IAAE,CAAC;AAI7E,SAAK,UAAU,UAAU,EAAI,UAAU,MAAK,CAAG;AAC3C,WAAO,CAAA,OAAM,kBAAkB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,OAAK,CAAC,CAAC;IACrE,CAAC;AAID,SAAK,UAAU,WAAW,EAAI,UAAU,WAAU,CAAG;AACjD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,gBAAe,EAAI,KAAG,CAAC;AAC3B,AAAI,QAAA,CAAA,oBAAmB,EAAI,KAAG,CAAC;AAC/B,SAAI,MAAK,UAAU,AAAC,CAAC,WAAU,CAAC,CAAG;AAC/B,uBAAe,EAAI,CAAA,WAAU,MAAM,CAAC;AACpC,2BAAmB,EAAI,CAAA,WAAU,UAAU,CAAC;MAChD;AAAA,AACI,QAAA,CAAA,IAAG,EAAI,eAAa,CAAC;AACzB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,aAAa,CAAC,CAAG;AACrC,WAAG,EAAI,CAAA,IAAG,aAAa,WAAW,AAAC,CAAC,gBAAe,CAAC,CAAC;MACzD;AAAA,AACA,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,QAAQ,CAAC,CAAG;AAChC,WAAG,EAAI,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,eAAO,CAAA,KAAI,QAAQ,WAAW,AAAC,CAAC,oBAAmB,CAAC,CAAC;QAAE,CAAC,CAAC;MAC7F;AAAA,AAEA,WAAO,KAAG,CAAC;IACf,CAAC;AAID,SAAK,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG;AACxC,WAAO,CAAA,IAAG,SAAS,UAAU,AAAC,CAAC,GAAE,CAAG,CAAA,IAAG,cAAc,CAAC,CAAC;IAC3D,CAAC;AAKD,SAAK,UAAU,WAAW,EAAI,UAAS,AAAC,CAAE;AACtC,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,sBAAsB,CAAC,CAAG;AAC5C,aAAO,CAAA,IAAG,mBAAmB,CAAC;MAClC;AAAA,AACA,WAAO,CAAA,IAAG,cAAc,AAAC,CAAC,IAAG,sBAAsB,CAAC,CAAC;IACzD,CAAC;AAKD,SAAK,UAAU,SAAS,EAAI,UAAU,UAAS,CAAG;AAC9C,AAAI,QAAA,CAAA,oBAAmB,EAAI,CAAA,yBAAwB,AAAC,CAAC,UAAS,CAAC,CAAC;AAChE,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,YAAW,YAAY,MAAM,AAAC,CAAC,oBAAmB,CAAC,CAAC;AAChE,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,YAAW,YAAY,MAAM,AAAC,CAAC,oBAAmB,CAAG,EAAA,CAAC,CAAC;AAClE,AAAI,QAAA,CAAA,MAAK,EAAI,KAAG,CAAC;AAGjB,SAAI,KAAI,GAAK,GAAC,CAAG;AACb,cAAO,MAAK,UAAU,AAAC,CAAC,MAAK,OAAO,CAAC,CAAG;AACpC,eAAK,EAAI,CAAA,MAAK,OAAO,CAAC;QAC1B;AAAA,MACJ,KACK,KAAI,KAAI,GAAK,KAAG,CAAG;AACpB,aAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AACtB,cAAO,YAAW,YAAY,MAAM,AAAC,CAAC,IAAG,CAAC,CAAA,EAAK,KAAG,CAAG;AACjD,aAAG,EAAI,CAAA,YAAW,YAAY,MAAM,AAAC,CAAC,IAAG,CAAG,EAAA,CAAC,CAAC;AAC9C,eAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AACtB,aAAI,MAAK,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAG;AACxB,gBAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAI,oCAAkC,CAAC,CAAC;UACvI;AAAA,QACJ;AAAA,MACJ,KACK,KAAI,KAAI,GAAK,IAAE,CAAG;AACnB,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,SAAQ,EAAI,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAI,+CAA6C,CAAC,CAAC;MAClJ;AAAA,AACA,SAAI,IAAG,CAAE,IAAG,OAAO,EAAI,EAAA,CAAC,GAAK,GAAC,CAAG;AAC7B,mBAAW,YAAY,WAAW,AAAC,CAAC,IAAG,CAAC,CAAC;MAC7C;AAAA,AACA,SAAI,IAAG,OAAO,EAAI,EAAA,CAAG;AACjB,AAAI,UAAA,CAAA,GAAE,EAAI,CAAA,SAAQ,EAAI,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,UAAS,CAAC,CAAA,CAAI,gCAA8B,CAAC;AACnG,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,GAAE,CAAC,CAAC;MAC7C;AAAA,AAEI,QAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO,CAAC;AAC1B,YAAO,MAAK,UAAU,AAAC,CAAC,MAAK,CAAC,CAAG;AAC7B,UAAE,QAAQ,AAAC,CAAC,MAAK,oBAAoB,CAAC,CAAC;AACvC,aAAK,EAAI,CAAA,MAAK,OAAO,CAAC;MAC1B;AAAA,AACI,QAAA,CAAA,eAAc,EAAI,CAAA,IAAG,SAAS,SAAS,AAAC,CAAC,IAAG,CAAG,CAAA,MAAK,cAAc,CAAC,CAAC;AACxE,YAAO,GAAE,OAAO,EAAI,EAAA,CAAG;AACnB,sBAAc,EAAI,CAAA,GAAE,IAAI,AAAC,EAAC,aAAa,AAAC,CAAC,eAAc,CAAC,CAAC;MAC7D;AAAA,AACA,WAAO,gBAAc,CAAC;IAC1B,CAAC;AACD,SAAO,OAAK,CAAC;EACjB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,OAAO,EAAI,OAAK,CAAC;AACvB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAChC,YAAQ,AAAC,CAAC,UAAS,CAAG,OAAK,CAAC,CAAC;AAC7B,WAAS,WAAS,CAAE,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,gBAAe,CAAG;AACtD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,SAAO,CAAG,KAAG,CAAG,iBAAe,CAAC,CAAC;AACnD,SAAG,UAAU,EAAI,SAAO,CAAC;AACzB,SAAG,UAAU,UAAU,AAAC,CAAC,SAAU,MAAK,CAAG;AACvC,aAAO,CAAA,KAAI,cAAc,AAAC,CAAC,MAAK,CAAE,KAAI,CAAC,CAAG,CAAA,MAAK,UAAU,AAAC,CAAC,MAAK,CAAE,KAAI,CAAC,CAAC,CAAC,CAAC;MAC9E,CAAC,CAAC;AACF,SAAG,SAAS,oBAAoB,AAAC,CAAC,gBAAe,CAAC,CAAC;AACnD,SAAG,cAAc,AAAC,CAAC,QAAO,KAAK,AAAC,EAAC,CAAC,CAAC;IACvC;AAAA,AACA,aAAS,UAAU,OAAO,EAAI,UAAU,WAAU,CAAG,CAAA,mBAAkB,CAAG;AACtE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AAC/D,QAAA,CAAA,OAAM,EAAI,CAAA,aAAY,qBAAqB,AAAC,CAAC,WAAU,CAAC,CAAC;AAC7D,SAAI,OAAM,OAAO,EAAI,EAAA,CAAG;AACpB,cAAM,EAAI,CAAA,GAAE,EAAI,QAAM,CAAC;MAC3B;AAAA,AACI,QAAA,CAAA,OAAM,EAAI,CAAA,MAAK,UAAU,OAAO,KAAK,AAAC,CAAC,IAAG,CAAG,YAAU,CAAC,CAAC;AAC7D,SAAI,CAAC,mBAAkB,CAAG;AACtB,cAAM,EAAI,CAAA,OAAM,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAAE,cAAI,UAAU,GAAG,AAAC,CAAC,OAAM,CAAC,CAAC;QAAE,CAAC,CAAC;MACzE;AAAA,AACA,WAAO,QAAM,CAAC;IAClB,CAAC;AACD,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,CAAC,MAAK,CAAC,CAAC;AACV,QAAM,WAAW,EAAI,WAAS,CAAC;AAC/B,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AACjC,YAAQ,AAAC,CAAC,WAAU,CAAG,OAAK,CAAC,CAAC;AAC9B,WAAS,YAAU,CAAE,MAAK,CAAG,CAAA,aAAY,CAAG;AACxC,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,CAAA,MAAK,SAAS,CAAG,OAAK,CAAG,cAAY,CAAC,CAAC;AACzD,SAAG,OAAO,EAAI,OAAK,CAAC;IACxB;AAAA,AACA,cAAU,UAAU,cAAc,EAAI,UAAU,GAAE,CAAG,CAAA,mBAAkB,CAAG;AACtE,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AAEnE,WAAO,CAAA,IAAG,OAAO,cAAc,AAAC,CAAC,GAAE,CAAG,oBAAkB,CAAC,CAAC;IAC9D,CAAC;AACD,cAAU,UAAU,sBAAsB,EAAI,UAAU,WAAU,CAAG,CAAA,mBAAkB,CAAG;AACtF,SAAI,mBAAkB,IAAM,KAAK,EAAA,CAAG;AAAE,0BAAkB,EAAI,MAAI,CAAC;MAAE;AAAA,AAEnE,WAAO,CAAA,IAAG,OAAO,sBAAsB,AAAC,CAAC,WAAU,CAAG,oBAAkB,CAAC,CAAC;IAC9E,CAAC;AACD,SAAO,YAAU,CAAC;EACtB,CAAC,AAAC,CAAC,MAAK,CAAC,CAAC;AAKV,AAAI,IAAA,CAAA,KAAI,EAAI,IAAI,OAAK,AAAC,CAAC,GAAE,CAAC,CAAC;AAC3B,SAAS,0BAAwB,CAAE,UAAS,CAAG;AAC3C,SAAO,CAAA,YAAW,YAAY,OAAO,AAAC,CAAC,UAAS,CAAG,UAAU,YAAW,CAAG,CAAA,IAAG,CAAG;AAC7E,SAAI,MAAK,SAAS,AAAC,CAAC,IAAG,CAAC,CAAG;AACvB,aAAO,CAAA,YAAW,OAAO,AAAC,CAAC,MAAK,cAAc,MAAM,AAAC,CAAC,IAAG,CAAG,MAAI,CAAC,CAAC,CAAC;MACvE;AAAA,AACA,iBAAW,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACvB,WAAO,aAAW,CAAC;IACvB,CAAG,GAAC,CAAC,CAAC;EACV;AAAA,AACA,SAAS,eAAa,CAAE,eAAc,CAAG,CAAA,eAAc,CAAG;AACtD,AAAI,MAAA,CAAA,IAAG,EAAI,eAAa,CAAC;AACzB,OAAI,MAAK,UAAU,AAAC,CAAC,eAAc,MAAM,CAAC,CAAG;AACzC,SAAG,EAAI,CAAA,cAAa,AAAC,CAAC,eAAc,MAAM,CAAG,CAAA,MAAK,UAAU,AAAC,CAAC,eAAc,CAAC,CAAA,CAAI,CAAA,eAAc,MAAM,EAAI,KAAG,CAAC,CAAC;IAClH;AAAA,AACA,SAAO,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,MAAK,CAAG;AAC/B,SAAI,MAAK,GAAK,MAAI,CAAG;AACjB,aAAO,MAAI,CAAC;MAChB;AAAA,AACA,SAAI,eAAc,UAAU,MAAM,CAAG;AACjC,aAAO,KAAG,CAAC;MACf;AAAA,AACI,QAAA,CAAA,IAAG,EAAI,CAAA,2BAA0B,mBAAmB,AAAC,CAAC,eAAc,UAAU,cAAc,CAAC,CAAC;AAClG,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC,CAAG;AACxB,aAAO,CAAA,IAAG,AAAC,CAAC,eAAc,UAAU,CAAG,CAAA,MAAK,UAAU,AAAC,CAAC,eAAc,CAAC,CAAA,CAAI,CAAA,eAAc,UAAU,EAAI,KAAG,CAAC,CAAC;MAChH;AAAA,AACA,WAAO,KAAG,CAAC;IACf,CAAC,CAAC;EACN;AA9dA,AA8dA,OA9dK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA8dc;AC/djC,KAAK,SAAS,AAAC,CAAC,mCAAkC,CAAG,EAAC,gCAA+B,CAAE,sCAAoC,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,6BAA2B,CAAE,6BAA2B,CAAE,uBAAqB,CAAE,6BAA2B,CAAE,kCAAgC,CAAE,iCAA+B,CAAE,4CAA0C,CAAE,gDAA8C,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAxf,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,SAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,cAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;IAAE,CAAA;EACxE,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,4BAA2B,CAAC,CAAC;AACtD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,4BAA2B,CAAC,CAAC;AACtD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAS,CAAC,CAAC;AACnC,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAc,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,gCAAa,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,2CAAwB,CAAC,CAAC;AAChD,AAAI,IAAA,CAAA,2BAA0B,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA4B,CAAC,CAAC;AACxE,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AAUzD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAI5B,WAAS,aAAW,CAAE,WAAU,CAAG,CAAA,OAAM,CAAG,CAAA,aAAY,CAAG,CAAA,QAAO,CAAG;AACjE,SAAG,YAAY,EAAI,YAAU,CAAC;AAC9B,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,cAAc,EAAI,cAAY,CAAC;AAClC,SAAG,KAAK,EAAI,KAAG,CAAC;AAChB,SAAG,cAAc,EAAI,KAAG,CAAC;AACzB,SAAG,oBAAoB,EAAI,KAAG,CAAC;AAC/B,SAAI,MAAK,UAAU,AAAC,CAAC,QAAO,CAAC,CAAG;AAC5B,WAAG,KAAK,EAAI,SAAO,CAAC;AACpB,WAAG,cAAc,kBAAkB,AAAC,CAAC,IAAG,CAAC,CAAC;MAC9C,KACK;AACD,WAAG,cAAc,sBAAsB,AAAC,CAAC,IAAG,CAAC,CAAC;MAClD;AAAA,IACJ;AAAA,AAKA,eAAW,UAAU,SAAS,EAAI,UAAU,eAAc,CAAG;AACzD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,oBAAoB,CAAC;AAClD,SAAG,oBAAoB,EAAI,gBAAc,CAAC;AAC1C,AAAI,QAAA,CAAA,aAAY,EAAI,CAAA,eAAc,cAAc,CAAC;AACjD,AAAI,QAAA,CAAA,WAAU,EAAI,CAAA,IAAG,cAAc,YAAY,AAAC,CAAC,aAAY,CAAC,CAAC;AAC/D,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,IAAG,SAAS,QAAQ,AAAC,CAAC,CACjC,IAAG,KAAK,AAAC,CAAC,YAAW,WAAW,CAAC,QACtB,AAAC,CAAC,eAAc,UAAU,AAAC,EAAC,CAAC,CACxC,CAAA,IAAG,KAAK,AAAC,CAAC,aAAY,YAAY,CAAC,QAAQ,AAAC,CAAC,GAAI,CAAA,aAAY,YAAY,AAAC,CAAC,eAAc,OAAO,CAAC,CAAC,CAClG,CAAA,IAAG,KAAK,AAAC,CAAC,SAAQ,OAAO,CAAC,QAAQ,AAAC,CAAC,WAAU,CAAC,CACnD,CAAC,CAAC;AACF,WAAO,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,aAAY,CAAG,CAAA,IAAG,YAAY,CAAG,SAAO,CAAC,KACxE,AAAC,CAAC,SAAU,YAAW,CAAG;AAC9B,YAAI,cAAc,EAAI,aAAW,CAAC;AAClC,WAAI,2BAA0B,iBAAiB,AAAC,CAAC,OAAM,WAAW,CAAG,cAAY,CAAC,CAAG;AACjF,eAAO,CAAA,KAAI,cAAc,SAAS,WAAW,AAAC,CAAC,eAAc,CAAG,oBAAkB,CAAC,CAAC;QACxF;AAAA,MACJ,CAAC,CAAC;IACN,CAAC;AAMD,eAAW,UAAU,MAAM,EAAI,UAAU,eAAc,CAAG;AACtD,AAAI,QAAA,CAAA,mBAAkB,EAAI,CAAA,IAAG,oBAAoB,CAAC;AAClD,SAAG,oBAAoB,EAAI,gBAAc,CAAC;AAC1C,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,cAAc,CAAC,CAAG;AACpC,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,2DAA0D,CAAC,CAAC;MACrG;AAAA,AACA,WAAO,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,2BAA0B,iBAAiB,AAAC,CAAC,OAAM,QAAQ,CAAG,CAAA,IAAG,oBAAoB,cAAc,CAAC,CAAA,CACtI,CAAA,IAAG,cAAc,SAAS,QAAQ,AAAC,CAAC,eAAc,CAAG,oBAAkB,CAAC,CAAA,CACxE,KAAG,CAAC,CAAC;IACb,CAAC;AAKD,eAAW,UAAU,WAAW,EAAI,UAAU,eAAc,CAAG;AAC3D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,IAAG,EAAI,eAAa,CAAC;AACzB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,cAAc,CAAC,CAAA,EAAK,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAA,EACjF,CAAA,2BAA0B,iBAAiB,AAAC,CAAC,OAAM,aAAa,CAAG,CAAA,IAAG,oBAAoB,cAAc,CAAC,CAAG;AAC5G,WAAG,EAAI,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,IAAG,cAAc,SAAS,aAAa,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC,CAAC;MAC9H;AAAA,AACA,WAAO,CAAA,IAAG,KAAK,AAAC,CAAC,SAAU,CAAA,CAAG;AAC1B,WAAI,MAAK,UAAU,AAAC,CAAC,KAAI,cAAc,CAAC,CAAG;AACvC,cAAI,cAAc,QAAQ,AAAC,EAAC,CAAC;AAC7B,cAAI,cAAc,EAAI,KAAG,CAAC;QAC9B;AAAA,MACJ,CAAC,CAAC;IACN,CAAC;AASD,eAAW,UAAU,cAAc,EAAI,UAAU,eAAc,CAAG;AAC9D,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAG;AAC1C,aAAO,eAAa,CAAC;MACzB;AAAA,AACA,SAAI,2BAA0B,iBAAiB,AAAC,CAAC,OAAM,cAAc,CAAG,CAAA,IAAG,oBAAoB,cAAc,CAAC,CAAG;AAC7G,aAAO,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,IAAG,cAAc,SAAS,cAAc,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC,CAAC;MAC/H;AAAA,AACA,WAAO,eAAa,CAAC;IACzB,CAAC;AAWD,eAAW,UAAU,SAAS,EAAI,UAAU,eAAc,CAAG;AACzD,AAAI,QAAA,CAAA,MAAK,CAAC;AACV,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAA,EACvC,CAAA,IAAG,oBAAoB,cAAc,GAAK,CAAA,eAAc,cAAc,CAAG;AACzE,aAAK,EAAI,MAAI,CAAC;MAClB,KACK,KAAI,2BAA0B,iBAAiB,AAAC,CAAC,OAAM,SAAS,CAAG,CAAA,IAAG,oBAAoB,cAAc,CAAC,CAAG;AAC7G,aAAK,EAAI,CAAA,IAAG,cAAc,SAAS,SAAS,AAAC,CAAC,eAAc,CAAG,CAAA,IAAG,oBAAoB,CAAC,CAAC;MAC5F,KACK;AACD,aAAK,EAAI,CAAA,eAAc,GAAK,CAAA,IAAG,oBAAoB,CAAA,EAC/C,EAAC,MAAK,UAAU,AAAC,CAAC,eAAc,OAAO,CAAC,CAAA,EAAK,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,oBAAoB,OAAO,CAAC,CAAA,EACzF,CAAA,YAAW,iBAAiB,OAAO,AAAC,CAAC,eAAc,OAAO,CAAG,CAAA,IAAG,oBAAoB,OAAO,CAAC,CAAC,CAAC;MAC1G;AAAA,AACA,WAAO,CAAA,OAAM,eAAe,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAC;IACjD,CAAC;AACD,eAAW,EAAI,CAAA,UAAS,AAAC,CAAC,CACtB,UAAS,UAAU,AAAC,CAAC,CAAE,QAAO,CAAG,gBAAc,CAAE,CAAC,CAClD,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,UAAS,UAAU,AAAC,CAAC,MAAK,CAAC,CAAC,CACvC,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,UAAS,WAAW,CAAG,CAAA,UAAS,uBAAuB,CAAG,CAAA,SAAQ,OAAO,CAAG,OAAK,CAAC,CAAC,CACxH,CAAG,aAAW,CAAC,CAAC;AAChB,SAAO,aAAW,CAAC;EACvB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,aAAa,EAAI,aAAW,CAAC;AAlKnC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAkKqB;ACnKxC,KAAK,SAAS,AAAC,CAAC,iBAAgB,CAAG,EAAC,4BAA2B,CAAE,oCAAkC,CAAE,kCAAgC,CAAE,kCAAgC,CAAE,qCAAmC,CAAE,wCAAsC,CAAE,6CAA2C,CAAE,6CAA2C,CAAE,+BAA6B,CAAE,6CAA2C,CAAE,uCAAqC,CAAE,4CAA0C,CAAE,kCAAgC,CAAE,oBAAkB,CAAE,iCAA+B,CAAE,wCAAsC,CAAE,6CAA2C,CAAE,6BAA2B,CAAE,oCAAkC,CAAE,kCAAgC,CAAE,qCAAmC,CAAE,+BAA6B,CAAE,gBAAc,CAAE,gCAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA15B,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AAIzB,SAAS,SAAO,CAAE,CAAA,CAAG;AACjB,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAC,OAAM,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,cAAM,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,EACtE;AAAA,AACI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAoB,CAAC,CAAC;AAC7C,QAAM,OAAO,EAAI,CAAA,QAAO,OAAO,CAAC;AAChC,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,mCAA2B,CAAC,CAAC;AAC3D,QAAM,aAAa,EAAI,CAAA,eAAc,aAAa,CAAC;AACnD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAyB,CAAC,CAAC;AACvD,QAAM,WAAW,EAAI,CAAA,aAAY,WAAW,CAAC;AAC7C,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAyB,CAAC,CAAC;AACvD,QAAM,YAAY,EAAI,CAAA,aAAY,YAAY,CAAC;AAC/C,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,OAAM,AAAC,CAAC,oCAA4B,CAAC,CAAC;AAC7D,QAAM,cAAc,EAAI,CAAA,gBAAe,cAAc,CAAC;AACtD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAA+B,CAAC,CAAC;AACnE,QAAM,iBAAiB,EAAI,CAAA,mBAAkB,iBAAiB,CAAC;AAC/D,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAAoC,CAAC,CAAC;AAC7E,QAAM,qBAAqB,EAAI,CAAA,wBAAuB,qBAAqB,CAAC;AAC5E,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAAoC,CAAC,CAAC;AAC7E,QAAM,qBAAqB,EAAI,CAAA,wBAAuB,qBAAqB,CAAC;AAC5E,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,8BAAsB,CAAC,CAAC;AACjD,QAAM,SAAS,EAAI,CAAA,UAAS,SAAS,CAAC;AACtC,QAAM,cAAc,EAAI,CAAA,UAAS,cAAc,CAAC;AAChD,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,4CAAoC,CAAC,CAAC,CAAC;AACxD,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,sCAA8B,CAAC,CAAC,CAAC;AAClD,AAAI,IAAA,CAAA,uBAAsB,EAAI,CAAA,OAAM,AAAC,CAAC,2CAAmC,CAAC,CAAC;AAC3E,QAAM,YAAY,EAAI,CAAA,uBAAsB,YAAY,CAAC;AACzD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAyB,CAAC,CAAC;AACvD,QAAM,YAAY,EAAI,CAAA,aAAY,YAAY,CAAC;AAC/C,QAAM,qBAAqB,EAAI,CAAA,aAAY,qBAAqB,CAAC;AACjE,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,mBAAkB,CAAC,CAAC;AAC7C,QAAM,YAAY,EAAI,CAAA,UAAS,YAAY,CAAC;AAC5C,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,gCAAwB,CAAC,CAAC;AACrD,QAAM,WAAW,EAAI,CAAA,YAAW,WAAW,CAAC;AAC5C,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAA+B,CAAC,CAAC;AACnE,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAAoC,CAAC,CAAC;AAC7E,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAoB,CAAC,CAAC;AAC7C,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,mCAA2B,CAAC,CAAC;AAC3D,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAyB,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,OAAM,AAAC,CAAC,oCAA4B,CAAC,CAAC;AAC7D,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,8BAAsB,CAAC,CAAC;AACjD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,eAAO,CAAC,CAAC;AAC9B,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAAuB,CAAC,CAAC;AAkC9C,QAAM,yBAAyB,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,MAAK,YAAY,AAAC,CAAC,wBAAuB,CAAC,CAAC,CAAC;AAwBtG,QAAM,kBAAkB,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,CAAC,eAAc,aAAa,CAAG,CAAA,aAAY,WAAW,CAAC,CAAC,CAAC;AAmCvG,QAAM,gBAAgB,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,CACxC,gBAAe,cAAc,CAC7B,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,MAAK,QAAQ,AAAC,CAAC,mBAAkB,iBAAiB,CAAG,EAAE,OAAM,CAAG,CAAA,wBAAuB,qBAAqB,CAAE,CAAC,CAAC,CACtI,CAAA,UAAS,SAAS,CAClB,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,MAAK,QAAQ,AAAC,CAAC,QAAO,OAAO,CAAG;AAClD,YAAQ,CAAG,cAAY;AACvB,OAAG,CAAG,CAAA,MAAK,WAAW,AAAC,CAAC,CAAC,gBAAe,cAAc,CAAG,CAAA,UAAS,SAAS,CAAG,CAAA,OAAM,yBAAyB,CAAC,CAAC;AAAA,EACnH,CAAC,CAAC,CACN,CAAC,CAAC;AACF,SAAS,cAAY,CAAE,QAAO,CAAG,CAAA,QAAO,CAAG,CAAA,gBAAe,CAAG;AACzD,SAAO,IAAI,CAAA,QAAO,WAAW,AAAC,CAAC,QAAO,CAAG,SAAO,CAAG,iBAAe,CAAC,CAAC;EACxE;AAAA,AAuBA,SAAS,eAAa,CAAE,gBAAe,CAAG;AACtC,SAAO,EAAC,OAAM,gBAAgB,CAAG,CAAA,MAAK,KAAK,AAAC,CAAC,OAAM,yBAAyB,CAAC,QAAQ,AAAC,CAAC,gBAAe,CAAC,CAAC,CAAC;EAC7G;AAAA,AACA,QAAM,eAAe,EAAI,eAAa,CAAC;AAhLvC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAgLc","file":"dist/js/bundle/router.dev.js"} \ No newline at end of file diff --git a/2.0.0-snapshot/test_lib.dev.js b/2.0.0-snapshot/test_lib.dev.js new file mode 100644 index 0000000000..685fdc9dc6 --- /dev/null +++ b/2.0.0-snapshot/test_lib.dev.js @@ -0,0 +1,2181 @@ +"format register"; +System.register("angular2/src/core/render/xhr_mock", ["angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var MockXHR = (function(_super) { + __extends(MockXHR, _super); + function MockXHR() { + _super.call(this); + this._expectations = []; + this._definitions = new collection_1.Map(); + this._requests = []; + } + MockXHR.prototype.get = function(url) { + var request = new _PendingRequest(url); + this._requests.push(request); + return request.getPromise(); + }; + MockXHR.prototype.expect = function(url, response) { + var expectation = new _Expectation(url, response); + this._expectations.push(expectation); + }; + MockXHR.prototype.when = function(url, response) { + this._definitions.set(url, response); + }; + MockXHR.prototype.flush = function() { + if (this._requests.length === 0) { + throw new exceptions_1.BaseException('No pending requests to flush'); + } + do { + var request = collection_1.ListWrapper.removeAt(this._requests, 0); + this._processRequest(request); + } while (this._requests.length > 0); + this.verifyNoOustandingExpectations(); + }; + MockXHR.prototype.verifyNoOustandingExpectations = function() { + if (this._expectations.length === 0) + return ; + var urls = []; + for (var i = 0; i < this._expectations.length; i++) { + var expectation = this._expectations[i]; + urls.push(expectation.url); + } + throw new exceptions_1.BaseException("Unsatisfied requests: " + collection_1.ListWrapper.join(urls, ', ')); + }; + MockXHR.prototype._processRequest = function(request) { + var url = request.url; + if (this._expectations.length > 0) { + var expectation = this._expectations[0]; + if (expectation.url == url) { + collection_1.ListWrapper.remove(this._expectations, expectation); + request.complete(expectation.response); + return ; + } + } + if (this._definitions.has(url)) { + var response = this._definitions.get(url); + request.complete(lang_1.normalizeBlank(response)); + return ; + } + throw new exceptions_1.BaseException("Unexpected request " + url); + }; + return MockXHR; + })(xhr_1.XHR); + exports.MockXHR = MockXHR; + var _PendingRequest = (function() { + function _PendingRequest(url) { + this.url = url; + this.completer = async_1.PromiseWrapper.completer(); + } + _PendingRequest.prototype.complete = function(response) { + if (lang_1.isBlank(response)) { + this.completer.reject("Failed to load " + this.url, null); + } else { + this.completer.resolve(response); + } + }; + _PendingRequest.prototype.getPromise = function() { + return this.completer.promise; + }; + return _PendingRequest; + })(); + var _Expectation = (function() { + function _Expectation(url, response) { + this.url = url; + this.response = response; + } + return _Expectation; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/router/location_strategy", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var LocationStrategy = (function() { + function LocationStrategy() {} + LocationStrategy.prototype.path = function() { + throw _abstract(); + }; + LocationStrategy.prototype.pushState = function(ctx, title, url) { + throw _abstract(); + }; + LocationStrategy.prototype.forward = function() { + throw _abstract(); + }; + LocationStrategy.prototype.back = function() { + throw _abstract(); + }; + LocationStrategy.prototype.onPopState = function(fn) { + throw _abstract(); + }; + LocationStrategy.prototype.getBaseHref = function() { + throw _abstract(); + }; + return LocationStrategy; + })(); + exports.LocationStrategy = LocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/mock/mock_location_strategy", ["angular2/src/core/facade/async", "angular2/src/router/location_strategy"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var async_1 = require("angular2/src/core/facade/async"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var MockLocationStrategy = (function(_super) { + __extends(MockLocationStrategy, _super); + function MockLocationStrategy() { + _super.call(this); + this.internalBaseHref = '/'; + this.internalPath = '/'; + this.internalTitle = ''; + this.urlChanges = []; + this._subject = new async_1.EventEmitter(); + } + MockLocationStrategy.prototype.simulatePopState = function(url) { + this.internalPath = url; + async_1.ObservableWrapper.callNext(this._subject, null); + }; + MockLocationStrategy.prototype.path = function() { + return this.internalPath; + }; + MockLocationStrategy.prototype.simulateUrlPop = function(pathname) { + async_1.ObservableWrapper.callNext(this._subject, {'url': pathname}); + }; + MockLocationStrategy.prototype.pushState = function(ctx, title, url) { + this.internalTitle = title; + this.internalPath = url; + this.urlChanges.push(url); + }; + MockLocationStrategy.prototype.onPopState = function(fn) { + async_1.ObservableWrapper.subscribe(this._subject, fn); + }; + MockLocationStrategy.prototype.getBaseHref = function() { + return this.internalBaseHref; + }; + MockLocationStrategy.prototype.back = function() { + if (this.urlChanges.length > 0) { + this.urlChanges.pop(); + var nextUrl = this.urlChanges.length > 0 ? this.urlChanges[this.urlChanges.length - 1] : ''; + this.simulatePopState(nextUrl); + } + }; + return MockLocationStrategy; + })(location_strategy_1.LocationStrategy); + exports.MockLocationStrategy = MockLocationStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/mock/view_resolver_mock", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/compiler/view_resolver"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var MockViewResolver = (function(_super) { + __extends(MockViewResolver, _super); + function MockViewResolver() { + _super.call(this); + this._views = new collection_1.Map(); + this._inlineTemplates = new collection_1.Map(); + this._viewCache = new collection_1.Map(); + this._directiveOverrides = new collection_1.Map(); + } + MockViewResolver.prototype.setView = function(component, view) { + this._checkOverrideable(component); + this._views.set(component, view); + }; + MockViewResolver.prototype.setInlineTemplate = function(component, template) { + this._checkOverrideable(component); + this._inlineTemplates.set(component, template); + }; + MockViewResolver.prototype.overrideViewDirective = function(component, from, to) { + this._checkOverrideable(component); + var overrides = this._directiveOverrides.get(component); + if (lang_1.isBlank(overrides)) { + overrides = new collection_1.Map(); + this._directiveOverrides.set(component, overrides); + } + overrides.set(from, to); + }; + MockViewResolver.prototype.resolve = function(component) { + var view = this._viewCache.get(component); + if (lang_1.isPresent(view)) + return view; + view = this._views.get(component); + if (lang_1.isBlank(view)) { + view = _super.prototype.resolve.call(this, component); + } + var directives = view.directives; + var overrides = this._directiveOverrides.get(component); + if (lang_1.isPresent(overrides) && lang_1.isPresent(directives)) { + directives = collection_1.ListWrapper.clone(view.directives); + collection_1.MapWrapper.forEach(overrides, function(to, from) { + var srcIndex = directives.indexOf(from); + if (srcIndex == -1) { + throw new exceptions_1.BaseException("Overriden directive " + lang_1.stringify(from) + " not found in the template of " + lang_1.stringify(component)); + } + directives[srcIndex] = to; + }); + view = new metadata_1.ViewMetadata({ + template: view.template, + templateUrl: view.templateUrl, + directives: directives + }); + } + var inlineTemplate = this._inlineTemplates.get(component); + if (lang_1.isPresent(inlineTemplate)) { + view = new metadata_1.ViewMetadata({ + template: inlineTemplate, + templateUrl: null, + directives: view.directives + }); + } + this._viewCache.set(component, view); + return view; + }; + MockViewResolver.prototype._checkOverrideable = function(component) { + var cached = this._viewCache.get(component); + if (lang_1.isPresent(cached)) { + throw new exceptions_1.BaseException("The component " + lang_1.stringify(component) + " has already been compiled, its configuration can not be changed"); + } + }; + return MockViewResolver; + })(view_resolver_1.ViewResolver); + exports.MockViewResolver = MockViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/mock", ["angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/view_resolver_mock", "angular2/src/core/render/xhr_mock"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/mock/mock_location_strategy")); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + exports.LocationStrategy = location_strategy_1.LocationStrategy; + var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock"); + exports.MockViewResolver = view_resolver_mock_1.MockViewResolver; + var xhr_mock_1 = require("angular2/src/core/render/xhr_mock"); + exports.MockXHR = xhr_mock_1.MockXHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/mock/animation_builder_mock", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/animate/css_animation_builder", "angular2/src/animate/animation", "angular2/src/animate/browser_details"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 animation_builder_1 = require("angular2/src/animate/animation_builder"); + var css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var animation_1 = require("angular2/src/animate/animation"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var MockAnimationBuilder = (function(_super) { + __extends(MockAnimationBuilder, _super); + function MockAnimationBuilder() { + _super.call(this, null); + } + MockAnimationBuilder.prototype.css = function() { + return new MockCssAnimationBuilder(); + }; + MockAnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], MockAnimationBuilder); + return MockAnimationBuilder; + })(animation_builder_1.AnimationBuilder); + exports.MockAnimationBuilder = MockAnimationBuilder; + var MockCssAnimationBuilder = (function(_super) { + __extends(MockCssAnimationBuilder, _super); + function MockCssAnimationBuilder() { + _super.call(this, null); + } + MockCssAnimationBuilder.prototype.start = function(element) { + return new MockAnimation(element, this.data); + }; + return MockCssAnimationBuilder; + })(css_animation_builder_1.CssAnimationBuilder); + var MockBrowserAbstraction = (function(_super) { + __extends(MockBrowserAbstraction, _super); + function MockBrowserAbstraction() { + _super.apply(this, arguments); + } + MockBrowserAbstraction.prototype.doesElapsedTimeIncludesDelay = function() { + this.elapsedTimeIncludesDelay = false; + }; + return MockBrowserAbstraction; + })(browser_details_1.BrowserDetails); + var MockAnimation = (function(_super) { + __extends(MockAnimation, _super); + function MockAnimation(element, data) { + _super.call(this, element, data, new MockBrowserAbstraction()); + } + MockAnimation.prototype.wait = function(callback) { + this._callback = callback; + }; + MockAnimation.prototype.flush = function() { + this._callback(0); + this._callback = null; + }; + return MockAnimation; + })(animation_1.Animation); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/mock/directive_resolver_mock", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler/directive_resolver"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var MockDirectiveResolver = (function(_super) { + __extends(MockDirectiveResolver, _super); + function MockDirectiveResolver() { + _super.apply(this, arguments); + this._bindingsOverrides = new collection_1.Map(); + this._viewBindingsOverrides = new collection_1.Map(); + } + MockDirectiveResolver.prototype.resolve = function(type) { + var dm = _super.prototype.resolve.call(this, type); + var bindingsOverride = this._bindingsOverrides.get(type); + var viewBindingsOverride = this._viewBindingsOverrides.get(type); + var bindings = dm.bindings; + if (lang_1.isPresent(bindingsOverride)) { + bindings = dm.bindings.concat(bindingsOverride); + } + if (dm instanceof metadata_1.ComponentMetadata) { + var viewBindings = dm.viewBindings; + if (lang_1.isPresent(viewBindingsOverride)) { + viewBindings = dm.viewBindings.concat(viewBindingsOverride); + } + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: dm.properties, + events: dm.events, + host: dm.host, + bindings: bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: dm.queries, + changeDetection: dm.changeDetection, + viewBindings: viewBindings + }); + } + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: dm.properties, + events: dm.events, + host: dm.host, + bindings: bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: dm.queries + }); + }; + MockDirectiveResolver.prototype.setBindingsOverride = function(type, bindings) { + this._bindingsOverrides.set(type, bindings); + }; + MockDirectiveResolver.prototype.setViewBindingsOverride = function(type, viewBindings) { + this._viewBindingsOverrides.set(type, viewBindings); + }; + return MockDirectiveResolver; + })(directive_resolver_1.DirectiveResolver); + exports.MockDirectiveResolver = MockDirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/mock/ng_zone_mock", ["angular2/src/core/zone/ng_zone"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var MockNgZone = (function(_super) { + __extends(MockNgZone, _super); + function MockNgZone() { + _super.call(this, {enableLongStackTrace: false}); + } + MockNgZone.prototype.run = function(fn) { + return fn(); + }; + MockNgZone.prototype.runOutsideAngular = function(fn) { + return fn(); + }; + MockNgZone.prototype.overrideOnEventDone = function(fn, opt_waitForAsync) { + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + this._onEventDone = fn; + }; + MockNgZone.prototype.simulateZoneExit = function() { + this._onEventDone(); + }; + return MockNgZone; + })(ng_zone_1.NgZone); + exports.MockNgZone = MockNgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/test_lib/utils", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var Log = (function() { + function Log() { + this._result = []; + } + Log.prototype.add = function(value) { + this._result.push(value); + }; + Log.prototype.fn = function(value) { + var _this = this; + return function(a1, a2, a3, a4, a5) { + if (a1 === void 0) { + a1 = null; + } + if (a2 === void 0) { + a2 = null; + } + if (a3 === void 0) { + a3 = null; + } + if (a4 === void 0) { + a4 = null; + } + if (a5 === void 0) { + a5 = null; + } + _this._result.push(value); + }; + }; + Log.prototype.clear = function() { + this._result = []; + }; + Log.prototype.result = function() { + return collection_1.ListWrapper.join(this._result, "; "); + }; + return Log; + })(); + exports.Log = Log; + var BrowserDetection = (function() { + function BrowserDetection(ua) { + if (lang_1.isPresent(ua)) { + this._ua = ua; + } else { + this._ua = lang_1.isPresent(dom_adapter_1.DOM) ? dom_adapter_1.DOM.getUserAgent() : ''; + } + } + Object.defineProperty(BrowserDetection.prototype, "isFirefox", { + get: function() { + return this._ua.indexOf('Firefox') > -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isAndroid", { + get: function() { + return this._ua.indexOf('Mozilla/5.0') > -1 && this._ua.indexOf('Android') > -1 && this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Chrome') == -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isEdge", { + get: function() { + return this._ua.indexOf('Edge') > -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isIE", { + get: function() { + return this._ua.indexOf('Trident') > -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isWebkit", { + get: function() { + return this._ua.indexOf('AppleWebKit') > -1 && this._ua.indexOf('Edge') == -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isIOS7", { + get: function() { + return this._ua.indexOf('iPhone OS 7') > -1 || this._ua.indexOf('iPad OS 7') > -1; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "isSlow", { + get: function() { + return this.isAndroid || this.isIE || this.isIOS7; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(BrowserDetection.prototype, "supportsIntlApi", { + get: function() { + return this._ua.indexOf('Chrome/4') > -1 && this._ua.indexOf('Edge') == -1; + }, + enumerable: true, + configurable: true + }); + return BrowserDetection; + })(); + exports.BrowserDetection = BrowserDetection; + exports.browserDetection = new BrowserDetection(null); + function dispatchEvent(element, eventType) { + dom_adapter_1.DOM.dispatchEvent(element, dom_adapter_1.DOM.createEvent(eventType)); + } + exports.dispatchEvent = dispatchEvent; + function el(html) { + return dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(html))); + } + exports.el = el; + var _RE_SPECIAL_CHARS = ['-', '[', ']', '/', '{', '}', '\\', '(', ')', '*', '+', '?', '.', '^', '$', '|']; + var _ESCAPE_RE = lang_1.RegExpWrapper.create("[\\" + _RE_SPECIAL_CHARS.join('\\') + "]"); + function containsRegexp(input) { + return lang_1.RegExpWrapper.create(lang_1.StringWrapper.replaceAllMapped(input, _ESCAPE_RE, function(match) { + return ("\\" + match[0]); + })); + } + exports.containsRegexp = containsRegexp; + function normalizeCSS(css) { + css = lang_1.StringWrapper.replaceAll(css, /\s+/g, ' '); + css = lang_1.StringWrapper.replaceAll(css, /:\s/g, ':'); + css = lang_1.StringWrapper.replaceAll(css, /'/g, '"'); + css = lang_1.StringWrapper.replaceAll(css, / }/g, '}'); + css = lang_1.StringWrapper.replaceAllMapped(css, /url\(\"(.+)\\"\)/g, function(match) { + return ("url(" + match[1] + ")"); + }); + css = lang_1.StringWrapper.replaceAllMapped(css, /\[(.+)=([^"\]]+)\]/g, function(match) { + return ("[" + match[1] + "=\"" + match[2] + "\"]"); + }); + return css; + } + exports.normalizeCSS = normalizeCSS; + var _singleTagWhitelist = ['br', 'hr', 'input']; + function stringifyElement(el) { + var result = ''; + if (dom_adapter_1.DOM.isElementNode(el)) { + var tagName = lang_1.StringWrapper.toLowerCase(dom_adapter_1.DOM.tagName(el)); + result += "<" + tagName; + var attributeMap = dom_adapter_1.DOM.attributeMap(el); + var keys = []; + collection_1.MapWrapper.forEach(attributeMap, function(v, k) { + keys.push(k); + }); + collection_1.ListWrapper.sort(keys); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var attValue = attributeMap.get(key); + if (!lang_1.isString(attValue)) { + result += " " + key; + } else { + result += " " + key + "=\"" + attValue + "\""; + } + } + result += '>'; + var children = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(el)); + for (var j = 0; j < children.length; j++) { + result += stringifyElement(children[j]); + } + if (!collection_1.ListWrapper.contains(_singleTagWhitelist, tagName)) { + result += ""; + } + } else if (dom_adapter_1.DOM.isCommentNode(el)) { + result += ""; + } else { + result += dom_adapter_1.DOM.getText(el); + } + return result; + } + exports.stringifyElement = stringifyElement; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/api", ["angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + exports.ON_WEB_WORKER = lang_1.CONST_EXPR(new di_1.OpaqueToken('WebWorker.onWebWorker')); + var WebWorkerElementRef = (function() { + function WebWorkerElementRef(renderView, renderBoundElementIndex) { + this.renderView = renderView; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return WebWorkerElementRef; + })(); + exports.WebWorkerElementRef = WebWorkerElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_proto_view_ref_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var RenderProtoViewRefStore = (function() { + function RenderProtoViewRefStore(onWebworker) { + this._lookupByIndex = new Map(); + this._lookupByProtoView = new Map(); + this._nextIndex = 0; + this._onWebworker = onWebworker; + } + RenderProtoViewRefStore.prototype.storeRenderProtoViewRef = function(ref) { + if (this._lookupByProtoView.has(ref)) { + return this._lookupByProtoView.get(ref); + } else { + this._lookupByIndex.set(this._nextIndex, ref); + this._lookupByProtoView.set(ref, this._nextIndex); + return this._nextIndex++; + } + }; + RenderProtoViewRefStore.prototype.retreiveRenderProtoViewRef = function(index) { + return this._lookupByIndex.get(index); + }; + RenderProtoViewRefStore.prototype.deserialize = function(index) { + if (index == null) { + return null; + } + if (this._onWebworker) { + return new WebWorkerRenderProtoViewRef(index); + } else { + return this.retreiveRenderProtoViewRef(index); + } + }; + RenderProtoViewRefStore.prototype.serialize = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebworker) { + return ref.refNumber; + } else { + return this.storeRenderProtoViewRef(ref); + } + }; + RenderProtoViewRefStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderProtoViewRefStore); + return RenderProtoViewRefStore; + })(); + exports.RenderProtoViewRefStore = RenderProtoViewRefStore; + var WebWorkerRenderProtoViewRef = (function(_super) { + __extends(WebWorkerRenderProtoViewRef, _super); + function WebWorkerRenderProtoViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + return WebWorkerRenderProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.WebWorkerRenderProtoViewRef = WebWorkerRenderProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_view_with_fragments_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var collection_1 = require("angular2/src/core/facade/collection"); + var RenderViewWithFragmentsStore = (function() { + function RenderViewWithFragmentsStore(onWebWorker) { + this._nextIndex = 0; + this._onWebWorker = onWebWorker; + this._lookupByIndex = new Map(); + this._lookupByView = new Map(); + this._viewFragments = new Map(); + } + RenderViewWithFragmentsStore.prototype.allocate = function(fragmentCount) { + var initialIndex = this._nextIndex; + var viewRef = new WebWorkerRenderViewRef(this._nextIndex++); + var fragmentRefs = collection_1.ListWrapper.createGrowableSize(fragmentCount); + for (var i = 0; i < fragmentCount; i++) { + fragmentRefs[i] = new WebWorkerRenderFragmentRef(this._nextIndex++); + } + var renderViewWithFragments = new api_1.RenderViewWithFragments(viewRef, fragmentRefs); + this.store(renderViewWithFragments, initialIndex); + return renderViewWithFragments; + }; + RenderViewWithFragmentsStore.prototype.store = function(view, startIndex) { + var _this = this; + this._lookupByIndex.set(startIndex, view.viewRef); + this._lookupByView.set(view.viewRef, startIndex); + startIndex++; + collection_1.ListWrapper.forEach(view.fragmentRefs, function(ref) { + _this._lookupByIndex.set(startIndex, ref); + _this._lookupByView.set(ref, startIndex); + startIndex++; + }); + this._viewFragments.set(view.viewRef, view.fragmentRefs); + }; + RenderViewWithFragmentsStore.prototype.remove = function(view) { + var _this = this; + this._removeRef(view); + var fragments = this._viewFragments.get(view); + fragments.forEach(function(fragment) { + _this._removeRef(fragment); + }); + collection_1.MapWrapper.delete(this._viewFragments, view); + }; + RenderViewWithFragmentsStore.prototype._removeRef = function(ref) { + var index = this._lookupByView.get(ref); + collection_1.MapWrapper.delete(this._lookupByView, ref); + collection_1.MapWrapper.delete(this._lookupByIndex, index); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderViewRef = function(viewRef) { + return this._serializeRenderFragmentOrViewRef(viewRef); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderFragmentRef = function(fragmentRef) { + return this._serializeRenderFragmentOrViewRef(fragmentRef); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderViewRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderFragmentRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype._retrieve = function(ref) { + if (ref == null) { + return null; + } + if (!this._lookupByIndex.has(ref)) { + return null; + } + return this._lookupByIndex.get(ref); + }; + RenderViewWithFragmentsStore.prototype._serializeRenderFragmentOrViewRef = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return ref.serialize(); + } else { + return this._lookupByView.get(ref); + } + }; + RenderViewWithFragmentsStore.prototype.serializeViewWithFragments = function(view) { + var _this = this; + if (view == null) { + return null; + } + if (this._onWebWorker) { + return { + 'viewRef': view.viewRef.serialize(), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return val.serialize(); + }) + }; + } else { + return { + 'viewRef': this._lookupByView.get(view.viewRef), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return _this._lookupByView.get(val); + }) + }; + } + }; + RenderViewWithFragmentsStore.prototype.deserializeViewWithFragments = function(obj) { + var _this = this; + if (obj == null) { + return null; + } + var viewRef = this.deserializeRenderViewRef(obj['viewRef']); + var fragments = collection_1.ListWrapper.map(obj['fragmentRefs'], function(val) { + return _this.deserializeRenderFragmentRef(val); + }); + return new api_1.RenderViewWithFragments(viewRef, fragments); + }; + RenderViewWithFragmentsStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderViewWithFragmentsStore); + return RenderViewWithFragmentsStore; + })(); + exports.RenderViewWithFragmentsStore = RenderViewWithFragmentsStore; + var WebWorkerRenderViewRef = (function(_super) { + __extends(WebWorkerRenderViewRef, _super); + function WebWorkerRenderViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderViewRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderViewRef.deserialize = function(ref) { + return new WebWorkerRenderViewRef(ref); + }; + return WebWorkerRenderViewRef; + })(api_1.RenderViewRef); + exports.WebWorkerRenderViewRef = WebWorkerRenderViewRef; + var WebWorkerRenderFragmentRef = (function(_super) { + __extends(WebWorkerRenderFragmentRef, _super); + function WebWorkerRenderFragmentRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderFragmentRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderFragmentRef.deserialize = function(ref) { + return new WebWorkerRenderFragmentRef(ref); + }; + return WebWorkerRenderFragmentRef; + })(api_1.RenderFragmentRef); + exports.WebWorkerRenderFragmentRef = WebWorkerRenderFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/test_lib/fake_async", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _scheduler; + var _microtasks = []; + var _pendingPeriodicTimers = []; + var _pendingTimers = []; + function fakeAsync(fn) { + if (lang_1.global.zone._inFakeAsyncZone) { + throw new Error('fakeAsync() calls can not be nested'); + } + var fakeAsyncZone = lang_1.global.zone.fork({ + setTimeout: _setTimeout, + clearTimeout: _clearTimeout, + setInterval: _setInterval, + clearInterval: _clearInterval, + scheduleMicrotask: _scheduleMicrotask, + _inFakeAsyncZone: true + }); + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + _scheduler = new jasmine.DelayedFunctionScheduler(); + clearPendingTimers(); + var res = fakeAsyncZone.run(function() { + var res = fn.apply(void 0, args); + flushMicrotasks(); + return res; + }); + if (_pendingPeriodicTimers.length > 0) { + throw new exceptions_1.BaseException(_pendingPeriodicTimers.length + " periodic timer(s) still in the queue."); + } + if (_pendingTimers.length > 0) { + throw new exceptions_1.BaseException(_pendingTimers.length + " timer(s) still in the queue."); + } + _scheduler = null; + collection_1.ListWrapper.clear(_microtasks); + return res; + }; + } + exports.fakeAsync = fakeAsync; + function clearPendingTimers() { + collection_1.ListWrapper.clear(_microtasks); + collection_1.ListWrapper.clear(_pendingPeriodicTimers); + collection_1.ListWrapper.clear(_pendingTimers); + } + exports.clearPendingTimers = clearPendingTimers; + function tick(millis) { + if (millis === void 0) { + millis = 0; + } + _assertInFakeAsyncZone(); + flushMicrotasks(); + _scheduler.tick(millis); + } + exports.tick = tick; + function flushMicrotasks() { + _assertInFakeAsyncZone(); + while (_microtasks.length > 0) { + var microtask = collection_1.ListWrapper.removeAt(_microtasks, 0); + microtask(); + } + } + exports.flushMicrotasks = flushMicrotasks; + function _setTimeout(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var cb = _fnAndFlush(fn); + var id = _scheduler.scheduleFunction(cb, delay, args); + _pendingTimers.push(id); + _scheduler.scheduleFunction(_dequeueTimer(id), delay); + return id; + } + function _clearTimeout(id) { + _dequeueTimer(id); + return _scheduler.removeFunctionWithId(id); + } + function _setInterval(fn, interval) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var cb = _fnAndFlush(fn); + var id = _scheduler.scheduleFunction(cb, interval, args, true); + _pendingPeriodicTimers.push(id); + return id; + } + function _clearInterval(id) { + collection_1.ListWrapper.remove(_pendingPeriodicTimers, id); + return _scheduler.removeFunctionWithId(id); + } + function _fnAndFlush(fn) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + fn.apply(lang_1.global, args); + flushMicrotasks(); + }; + } + function _scheduleMicrotask(microtask) { + _microtasks.push(microtask); + } + function _dequeueTimer(id) { + return function() { + collection_1.ListWrapper.remove(_pendingTimers, id); + }; + } + function _assertInFakeAsyncZone() { + if (!lang_1.global.zone || !lang_1.global.zone._inFakeAsyncZone) { + throw new Error('The code should be running in the fakeAsync zone to call this function'); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/serializer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/di", "angular2/src/web_workers/shared/render_proto_view_ref_store", "angular2/src/web_workers/shared/render_view_with_fragments_store"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + var di_1 = require("angular2/src/core/di"); + var render_proto_view_ref_store_1 = require("angular2/src/web_workers/shared/render_proto_view_ref_store"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + exports.PRIMITIVE = String; + var Serializer = (function() { + function Serializer(_parser, _protoViewStore, _renderViewStore) { + this._parser = _parser; + this._protoViewStore = _protoViewStore; + this._renderViewStore = _renderViewStore; + this._enumRegistry = new collection_1.Map(); + var viewTypeMap = new collection_1.Map(); + viewTypeMap[0] = api_1.ViewType.HOST; + viewTypeMap[1] = api_1.ViewType.COMPONENT; + viewTypeMap[2] = api_1.ViewType.EMBEDDED; + this._enumRegistry.set(api_1.ViewType, viewTypeMap); + var viewEncapsulationMap = new collection_1.Map(); + viewEncapsulationMap[0] = api_1.ViewEncapsulation.Emulated; + viewEncapsulationMap[1] = api_1.ViewEncapsulation.Native; + viewEncapsulationMap[2] = api_1.ViewEncapsulation.None; + this._enumRegistry.set(api_1.ViewEncapsulation, viewEncapsulationMap); + var propertyBindingTypeMap = new collection_1.Map(); + propertyBindingTypeMap[0] = api_1.PropertyBindingType.PROPERTY; + propertyBindingTypeMap[1] = api_1.PropertyBindingType.ATTRIBUTE; + propertyBindingTypeMap[2] = api_1.PropertyBindingType.CLASS; + propertyBindingTypeMap[3] = api_1.PropertyBindingType.STYLE; + this._enumRegistry.set(api_1.PropertyBindingType, propertyBindingTypeMap); + } + Serializer.prototype.serialize = function(obj, type) { + var _this = this; + if (!lang_1.isPresent(obj)) { + return null; + } + if (lang_1.isArray(obj)) { + var serializedObj = []; + collection_1.ListWrapper.forEach(obj, function(val) { + serializedObj.push(_this.serialize(val, type)); + }); + return serializedObj; + } + if (type == exports.PRIMITIVE) { + return obj; + } + if (type == api_1.ViewDefinition) { + return this._serializeViewDefinition(obj); + } else if (type == api_1.DirectiveBinder) { + return this._serializeDirectiveBinder(obj); + } else if (type == api_1.ProtoViewDto) { + return this._serializeProtoViewDto(obj); + } else if (type == api_1.RenderElementBinder) { + return this._serializeElementBinder(obj); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._serializeDirectiveMetadata(obj); + } else if (type == change_detection_1.ASTWithSource) { + return this._serializeASTWithSource(obj); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.serialize(obj); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._serializeRenderProtoViewMergeMapping(obj); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.serializeRenderViewRef(obj); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.serializeRenderFragmentRef(obj); + } else if (type == api_2.WebWorkerElementRef) { + return this._serializeWorkerElementRef(obj); + } else if (type == api_1.ElementPropertyBinding) { + return this._serializeElementPropertyBinding(obj); + } else if (type == api_1.EventBinding) { + return this._serializeEventBinding(obj); + } else { + throw new exceptions_1.BaseException("No serializer for " + type.toString()); + } + }; + Serializer.prototype.deserialize = function(map, type, data) { + var _this = this; + if (!lang_1.isPresent(map)) { + return null; + } + if (lang_1.isArray(map)) { + var obj = []; + collection_1.ListWrapper.forEach(map, function(val) { + obj.push(_this.deserialize(val, type, data)); + }); + return obj; + } + if (type == exports.PRIMITIVE) { + return map; + } + if (type == api_1.ViewDefinition) { + return this._deserializeViewDefinition(map); + } else if (type == api_1.DirectiveBinder) { + return this._deserializeDirectiveBinder(map); + } else if (type == api_1.ProtoViewDto) { + return this._deserializeProtoViewDto(map); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._deserializeDirectiveMetadata(map); + } else if (type == api_1.RenderElementBinder) { + return this._deserializeElementBinder(map); + } else if (type == change_detection_1.ASTWithSource) { + return this._deserializeASTWithSource(map, data); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.deserialize(map); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._deserializeRenderProtoViewMergeMapping(map); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.deserializeRenderViewRef(map); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.deserializeRenderFragmentRef(map); + } else if (type == api_2.WebWorkerElementRef) { + return this._deserializeWorkerElementRef(map); + } else if (type == api_1.EventBinding) { + return this._deserializeEventBinding(map); + } else if (type == api_1.ElementPropertyBinding) { + return this._deserializeElementPropertyBinding(map); + } else { + throw new exceptions_1.BaseException("No deserializer for " + type.toString()); + } + }; + Serializer.prototype.mapToObject = function(map, type) { + var _this = this; + var object = {}; + var serialize = lang_1.isPresent(type); + collection_1.MapWrapper.forEach(map, function(value, key) { + if (serialize) { + object[key] = _this.serialize(value, type); + } else { + object[key] = value; + } + }); + return object; + }; + Serializer.prototype.objectToMap = function(obj, type, data) { + var _this = this; + if (lang_1.isPresent(type)) { + var map = new collection_1.Map(); + collection_1.StringMapWrapper.forEach(obj, function(val, key) { + map.set(key, _this.deserialize(val, type, data)); + }); + return map; + } else { + return collection_1.MapWrapper.createFromStringMap(obj); + } + }; + Serializer.prototype.allocateRenderViews = function(fragmentCount) { + this._renderViewStore.allocate(fragmentCount); + }; + Serializer.prototype._serializeElementPropertyBinding = function(binding) { + return { + 'type': lang_1.serializeEnum(binding.type), + 'astWithSource': this.serialize(binding.astWithSource, change_detection_1.ASTWithSource), + 'property': binding.property, + 'unit': binding.unit + }; + }; + Serializer.prototype._deserializeElementPropertyBinding = function(map) { + var type = lang_1.deserializeEnum(map['type'], this._enumRegistry.get(api_1.PropertyBindingType)); + var ast = this.deserialize(map['astWithSource'], change_detection_1.ASTWithSource, "binding"); + return new api_1.ElementPropertyBinding(type, ast, map['property'], map['unit']); + }; + Serializer.prototype._serializeEventBinding = function(binding) { + return { + 'fullName': binding.fullName, + 'source': this.serialize(binding.source, change_detection_1.ASTWithSource) + }; + }; + Serializer.prototype._deserializeEventBinding = function(map) { + return new api_1.EventBinding(map['fullName'], this.deserialize(map['source'], change_detection_1.ASTWithSource, "action")); + }; + Serializer.prototype._serializeWorkerElementRef = function(elementRef) { + return { + 'renderView': this.serialize(elementRef.renderView, api_1.RenderViewRef), + 'renderBoundElementIndex': elementRef.renderBoundElementIndex + }; + }; + Serializer.prototype._deserializeWorkerElementRef = function(map) { + return new api_2.WebWorkerElementRef(this.deserialize(map['renderView'], api_1.RenderViewRef), map['renderBoundElementIndex']); + }; + Serializer.prototype._serializeRenderProtoViewMergeMapping = function(mapping) { + return { + 'mergedProtoViewRef': this._protoViewStore.serialize(mapping.mergedProtoViewRef), + 'fragmentCount': mapping.fragmentCount, + 'mappedElementIndices': mapping.mappedElementIndices, + 'mappedElementCount': mapping.mappedElementCount, + 'mappedTextIndices': mapping.mappedTextIndices, + 'hostElementIndicesByViewIndex': mapping.hostElementIndicesByViewIndex, + 'nestedViewCountByViewIndex': mapping.nestedViewCountByViewIndex + }; + }; + Serializer.prototype._deserializeRenderProtoViewMergeMapping = function(obj) { + return new api_1.RenderProtoViewMergeMapping(this._protoViewStore.deserialize(obj['mergedProtoViewRef']), obj['fragmentCount'], obj['mappedElementIndices'], obj['mappedElementCount'], obj['mappedTextIndices'], obj['hostElementIndicesByViewIndex'], obj['nestedViewCountByViewIndex']); + }; + Serializer.prototype._serializeASTWithSource = function(tree) { + return { + 'input': tree.source, + 'location': tree.location + }; + }; + Serializer.prototype._deserializeASTWithSource = function(obj, data) { + var ast; + switch (data) { + case "action": + ast = this._parser.parseAction(obj['input'], obj['location']); + break; + case "binding": + ast = this._parser.parseBinding(obj['input'], obj['location']); + break; + case "interpolation": + ast = this._parser.parseInterpolation(obj['input'], obj['location']); + break; + default: + throw "No AST deserializer for " + data; + } + return ast; + }; + Serializer.prototype._serializeViewDefinition = function(view) { + return { + 'componentId': view.componentId, + 'templateAbsUrl': view.templateAbsUrl, + 'template': view.template, + 'directives': this.serialize(view.directives, api_1.RenderDirectiveMetadata), + 'styleAbsUrls': view.styleAbsUrls, + 'styles': view.styles, + 'encapsulation': lang_1.serializeEnum(view.encapsulation) + }; + }; + Serializer.prototype._deserializeViewDefinition = function(obj) { + return new api_1.ViewDefinition({ + componentId: obj['componentId'], + templateAbsUrl: obj['templateAbsUrl'], + template: obj['template'], + directives: this.deserialize(obj['directives'], api_1.RenderDirectiveMetadata), + styleAbsUrls: obj['styleAbsUrls'], + styles: obj['styles'], + encapsulation: lang_1.deserializeEnum(obj['encapsulation'], this._enumRegistry.get(api_1.ViewEncapsulation)) + }); + }; + Serializer.prototype._serializeDirectiveBinder = function(binder) { + return { + 'directiveIndex': binder.directiveIndex, + 'propertyBindings': this.mapToObject(binder.propertyBindings, change_detection_1.ASTWithSource), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'hostPropertyBindings': this.serialize(binder.hostPropertyBindings, api_1.ElementPropertyBinding) + }; + }; + Serializer.prototype._deserializeDirectiveBinder = function(obj) { + return new api_1.DirectiveBinder({ + directiveIndex: obj['directiveIndex'], + propertyBindings: this.objectToMap(obj['propertyBindings'], change_detection_1.ASTWithSource, "binding"), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + hostPropertyBindings: this.deserialize(obj['hostPropertyBindings'], api_1.ElementPropertyBinding) + }); + }; + Serializer.prototype._serializeElementBinder = function(binder) { + return { + 'index': binder.index, + 'parentIndex': binder.parentIndex, + 'distanceToParent': binder.distanceToParent, + 'directives': this.serialize(binder.directives, api_1.DirectiveBinder), + 'nestedProtoView': this.serialize(binder.nestedProtoView, api_1.ProtoViewDto), + 'propertyBindings': this.serialize(binder.propertyBindings, api_1.ElementPropertyBinding), + 'variableBindings': this.mapToObject(binder.variableBindings), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'readAttributes': this.mapToObject(binder.readAttributes) + }; + }; + Serializer.prototype._deserializeElementBinder = function(obj) { + return new api_1.RenderElementBinder({ + index: obj['index'], + parentIndex: obj['parentIndex'], + distanceToParent: obj['distanceToParent'], + directives: this.deserialize(obj['directives'], api_1.DirectiveBinder), + nestedProtoView: this.deserialize(obj['nestedProtoView'], api_1.ProtoViewDto), + propertyBindings: this.deserialize(obj['propertyBindings'], api_1.ElementPropertyBinding), + variableBindings: this.objectToMap(obj['variableBindings']), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + readAttributes: this.objectToMap(obj['readAttributes']) + }); + }; + Serializer.prototype._serializeProtoViewDto = function(view) { + return { + 'render': this._protoViewStore.serialize(view.render), + 'elementBinders': this.serialize(view.elementBinders, api_1.RenderElementBinder), + 'variableBindings': this.mapToObject(view.variableBindings), + 'type': lang_1.serializeEnum(view.type), + 'textBindings': this.serialize(view.textBindings, change_detection_1.ASTWithSource), + 'transitiveNgContentCount': view.transitiveNgContentCount + }; + }; + Serializer.prototype._deserializeProtoViewDto = function(obj) { + return new api_1.ProtoViewDto({ + render: this._protoViewStore.deserialize(obj["render"]), + elementBinders: this.deserialize(obj['elementBinders'], api_1.RenderElementBinder), + variableBindings: this.objectToMap(obj['variableBindings']), + textBindings: this.deserialize(obj['textBindings'], change_detection_1.ASTWithSource, "interpolation"), + type: lang_1.deserializeEnum(obj['type'], this._enumRegistry.get(api_1.ViewType)), + transitiveNgContentCount: obj['transitiveNgContentCount'] + }); + }; + Serializer.prototype._serializeDirectiveMetadata = function(meta) { + var obj = { + 'id': meta.id, + 'selector': meta.selector, + 'compileChildren': meta.compileChildren, + 'events': meta.events, + 'properties': meta.properties, + 'readAttributes': meta.readAttributes, + 'type': meta.type, + 'callOnDestroy': meta.callOnDestroy, + 'callOnChanges': meta.callOnChanges, + 'callDoCheck': meta.callDoCheck, + 'callOnInit': meta.callOnInit, + 'callAfterContentChecked': meta.callAfterContentChecked, + 'changeDetection': meta.changeDetection, + 'exportAs': meta.exportAs, + 'hostProperties': this.mapToObject(meta.hostProperties), + 'hostListeners': this.mapToObject(meta.hostListeners), + 'hostAttributes': this.mapToObject(meta.hostAttributes) + }; + return obj; + }; + Serializer.prototype._deserializeDirectiveMetadata = function(obj) { + return new api_1.RenderDirectiveMetadata({ + id: obj['id'], + selector: obj['selector'], + compileChildren: obj['compileChildren'], + hostProperties: this.objectToMap(obj['hostProperties']), + hostListeners: this.objectToMap(obj['hostListeners']), + hostAttributes: this.objectToMap(obj['hostAttributes']), + properties: obj['properties'], + readAttributes: obj['readAttributes'], + type: obj['type'], + exportAs: obj['exportAs'], + callOnDestroy: obj['callOnDestroy'], + callOnChanges: obj['callOnChanges'], + callDoCheck: obj['callDoCheck'], + callOnInit: obj['callOnInit'], + callAfterContentChecked: obj['callAfterContentChecked'], + changeDetection: obj['changeDetection'], + events: obj['events'] + }); + }; + Serializer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [parser_1.Parser, render_proto_view_ref_store_1.RenderProtoViewRefStore, render_view_with_fragments_store_1.RenderViewWithFragmentsStore])], Serializer); + return Serializer; + })(); + exports.Serializer = Serializer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/test_lib/test_component_builder", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/test_lib/utils", "angular2/src/core/render/render", "angular2/src/core/dom/dom_adapter", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var utils_1 = require("angular2/src/test_lib/utils"); + var render_1 = require("angular2/src/core/render/render"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var RootTestComponent = (function() { + function RootTestComponent(componentRef) { + this.debugElement = new debug_element_1.DebugElement(view_ref_1.internalView(componentRef.hostView), 0); + this._componentParentView = view_ref_1.internalView(componentRef.hostView); + this._componentRef = componentRef; + } + RootTestComponent.prototype.detectChanges = function() { + this._componentParentView.changeDetector.detectChanges(); + this._componentParentView.changeDetector.checkNoChanges(); + }; + RootTestComponent.prototype.destroy = function() { + this._componentRef.dispose(); + }; + return RootTestComponent; + })(); + exports.RootTestComponent = RootTestComponent; + var _nextRootElementId = 0; + var TestComponentBuilder = (function() { + function TestComponentBuilder(_injector) { + this._injector = _injector; + this._bindingsOverrides = new Map(); + this._directiveOverrides = new Map(); + this._templateOverrides = new Map(); + this._viewBindingsOverrides = new Map(); + this._viewOverrides = new Map(); + } + TestComponentBuilder.prototype._clone = function() { + var clone = new TestComponentBuilder(this._injector); + clone._viewOverrides = collection_1.MapWrapper.clone(this._viewOverrides); + clone._directiveOverrides = collection_1.MapWrapper.clone(this._directiveOverrides); + clone._templateOverrides = collection_1.MapWrapper.clone(this._templateOverrides); + return clone; + }; + TestComponentBuilder.prototype.overrideTemplate = function(componentType, template) { + var clone = this._clone(); + clone._templateOverrides.set(componentType, template); + return clone; + }; + TestComponentBuilder.prototype.overrideView = function(componentType, view) { + var clone = this._clone(); + clone._viewOverrides.set(componentType, view); + return clone; + }; + TestComponentBuilder.prototype.overrideDirective = function(componentType, from, to) { + var clone = this._clone(); + var overridesForComponent = clone._directiveOverrides.get(componentType); + if (!lang_1.isPresent(overridesForComponent)) { + clone._directiveOverrides.set(componentType, new Map()); + overridesForComponent = clone._directiveOverrides.get(componentType); + } + overridesForComponent.set(from, to); + return clone; + }; + TestComponentBuilder.prototype.overrideBindings = function(type, bindings) { + var clone = this._clone(); + clone._bindingsOverrides.set(type, bindings); + return clone; + }; + TestComponentBuilder.prototype.overrideViewBindings = function(type, bindings) { + var clone = this._clone(); + clone._viewBindingsOverrides.set(type, bindings); + return clone; + }; + TestComponentBuilder.prototype.createAsync = function(rootComponentType) { + var mockDirectiveResolver = this._injector.get(directive_resolver_1.DirectiveResolver); + var mockViewResolver = this._injector.get(view_resolver_1.ViewResolver); + collection_1.MapWrapper.forEach(this._viewOverrides, function(view, type) { + mockViewResolver.setView(type, view); + }); + collection_1.MapWrapper.forEach(this._templateOverrides, function(template, type) { + mockViewResolver.setInlineTemplate(type, template); + }); + collection_1.MapWrapper.forEach(this._directiveOverrides, function(overrides, component) { + collection_1.MapWrapper.forEach(overrides, function(to, from) { + mockViewResolver.overrideViewDirective(component, from, to); + }); + }); + this._bindingsOverrides.forEach(function(bindings, type) { + return mockDirectiveResolver.setBindingsOverride(type, bindings); + }); + this._viewBindingsOverrides.forEach(function(bindings, type) { + return mockDirectiveResolver.setViewBindingsOverride(type, bindings); + }); + var rootElId = "root" + _nextRootElementId++; + var rootEl = utils_1.el("
"); + var doc = this._injector.get(render_1.DOCUMENT); + var oldRoots = dom_adapter_1.DOM.querySelectorAll(doc, '[id^=root]'); + for (var i = 0; i < oldRoots.length; i++) { + dom_adapter_1.DOM.remove(oldRoots[i]); + } + dom_adapter_1.DOM.appendChild(doc.body, rootEl); + return this._injector.get(dynamic_component_loader_1.DynamicComponentLoader).loadAsRoot(rootComponentType, "#" + rootElId, this._injector).then(function(componentRef) { + return new RootTestComponent(componentRef); + }); + }; + TestComponentBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [di_1.Injector])], TestComponentBuilder); + return TestComponentBuilder; + })(); + exports.TestComponentBuilder = TestComponentBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/test_lib/test_injector", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/animate/animation_builder", "angular2/src/mock/animation_builder_mock", "angular2/src/core/compiler/compiler", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/render/xhr", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/zone/ng_zone", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/mock/directive_resolver_mock", "angular2/src/mock/view_resolver_mock", "angular2/src/core/render/xhr_mock", "angular2/src/mock/mock_location_strategy", "angular2/src/router/location_strategy", "angular2/src/mock/ng_zone_mock", "angular2/src/test_lib/test_component_builder", "angular2/src/core/di", "angular2/src/core/debug", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/render/api", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/web_workers/shared/serializer", "angular2/src/test_lib/utils", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var animation_builder_mock_1 = require("angular2/src/mock/animation_builder_mock"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var directive_resolver_mock_1 = require("angular2/src/mock/directive_resolver_mock"); + var view_resolver_mock_1 = require("angular2/src/mock/view_resolver_mock"); + var xhr_mock_1 = require("angular2/src/core/render/xhr_mock"); + var mock_location_strategy_1 = require("angular2/src/mock/mock_location_strategy"); + var location_strategy_1 = require("angular2/src/router/location_strategy"); + var ng_zone_mock_1 = require("angular2/src/mock/ng_zone_mock"); + var test_component_builder_1 = require("angular2/src/test_lib/test_component_builder"); + var di_2 = require("angular2/src/core/di"); + var debug_1 = require("angular2/src/core/debug"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var api_1 = require("angular2/src/core/render/api"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var utils_1 = require("angular2/src/test_lib/utils"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function _getRootBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector)]; + } + function _getAppBindings() { + var appDoc; + try { + appDoc = dom_adapter_1.DOM.defaultDoc(); + } catch (e) { + appDoc = null; + } + return [compiler_2.compilerBindings(), di_1.bind(render_1.DOCUMENT).toValue(appDoc), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), di_1.bind(render_1.APP_ID).toValue('a'), render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(-1), render_1.DefaultDomCompiler, di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), render_1.DomSharedStylesHost, di_1.bind(render_1.SharedStylesHost).toAlias(render_1.DomSharedStylesHost), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, serializer_1.Serializer, debug_1.ELEMENT_PROBE_BINDINGS, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(500), compiler_1.Compiler, compiler_1.CompilerCache, di_1.bind(directive_resolver_1.DirectiveResolver).toClass(directive_resolver_mock_1.MockDirectiveResolver), di_1.bind(view_resolver_1.ViewResolver).toClass(view_resolver_mock_1.MockViewResolver), pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(new change_detection_1.DynamicChangeDetection()), utils_1.Log, view_loader_1.ViewLoader, dynamic_component_loader_1.DynamicComponentLoader, pipe_resolver_1.PipeResolver, change_detection_1.Parser, change_detection_1.Lexer, di_1.bind(exceptions_1.ExceptionHandler).toValue(new exceptions_1.ExceptionHandler(dom_adapter_1.DOM)), di_1.bind(location_strategy_1.LocationStrategy).toClass(mock_location_strategy_1.MockLocationStrategy), di_1.bind(xhr_1.XHR).toClass(xhr_mock_1.MockXHR), component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), style_url_resolver_1.StyleUrlResolver, style_inliner_1.StyleInliner, test_component_builder_1.TestComponentBuilder, di_1.bind(ng_zone_1.NgZone).toClass(ng_zone_mock_1.MockNgZone), di_1.bind(animation_builder_1.AnimationBuilder).toClass(animation_builder_mock_1.MockAnimationBuilder), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + })]; + } + function createTestInjector(bindings) { + var rootInjector = di_2.Injector.resolveAndCreate(_getRootBindings()); + return rootInjector.resolveAndCreateChild(collection_1.ListWrapper.concat(_getAppBindings(), bindings)); + } + exports.createTestInjector = createTestInjector; + function inject(tokens, fn) { + return new FunctionWithParamTokens(tokens, fn); + } + exports.inject = inject; + var FunctionWithParamTokens = (function() { + function FunctionWithParamTokens(_tokens, _fn) { + this._tokens = _tokens; + this._fn = _fn; + } + FunctionWithParamTokens.prototype.execute = function(injector) { + var params = collection_1.ListWrapper.map(this._tokens, function(t) { + return injector.get(t); + }); + return lang_1.FunctionWrapper.apply(this._fn, params); + }; + FunctionWithParamTokens.prototype.hasToken = function(token) { + return this._tokens.indexOf(token) > -1; + }; + return FunctionWithParamTokens; + })(); + exports.FunctionWithParamTokens = FunctionWithParamTokens; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/test_lib/test_lib", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/test_lib/test_injector", "angular2/src/test_lib/utils", "angular2/src/test_lib/test_injector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var test_injector_1 = require("angular2/src/test_lib/test_injector"); + var utils_1 = require("angular2/src/test_lib/utils"); + var test_injector_2 = require("angular2/src/test_lib/test_injector"); + exports.inject = test_injector_2.inject; + exports.proxy = function(t) { + return t; + }; + var _global = (typeof window === 'undefined' ? lang_1.global : window); + exports.afterEach = _global.afterEach; + exports.expect = _global.expect; + var AsyncTestCompleter = (function() { + function AsyncTestCompleter(_done) { + this._done = _done; + } + AsyncTestCompleter.prototype.done = function() { + this._done(); + }; + return AsyncTestCompleter; + })(); + exports.AsyncTestCompleter = AsyncTestCompleter; + var jsmBeforeEach = _global.beforeEach; + var jsmDescribe = _global.describe; + var jsmDDescribe = _global.fdescribe; + var jsmXDescribe = _global.xdescribe; + var jsmIt = _global.it; + var jsmIIt = _global.fit; + var jsmXIt = _global.xit; + var runnerStack = []; + var inIt = false; + var globalTimeOut = utils_1.browserDetection.isSlow ? 3000 : jasmine.DEFAULT_TIMEOUT_INTERVAL; + var testBindings; + var BeforeEachRunner = (function() { + function BeforeEachRunner(_parent) { + this._parent = _parent; + this._fns = []; + } + BeforeEachRunner.prototype.beforeEach = function(fn) { + this._fns.push(fn); + }; + BeforeEachRunner.prototype.run = function(injector) { + if (this._parent) + this._parent.run(injector); + this._fns.forEach(function(fn) { + return lang_1.isFunction(fn) ? fn() : fn.execute(injector); + }); + }; + return BeforeEachRunner; + })(); + jsmBeforeEach(function() { + testBindings = []; + }); + function _describe(jsmFn) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var parentRunner = runnerStack.length === 0 ? null : runnerStack[runnerStack.length - 1]; + var runner = new BeforeEachRunner(parentRunner); + runnerStack.push(runner); + var suite = jsmFn.apply(void 0, args); + runnerStack.pop(); + return suite; + } + function describe() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return _describe.apply(void 0, [jsmDescribe].concat(args)); + } + exports.describe = describe; + function ddescribe() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return _describe.apply(void 0, [jsmDDescribe].concat(args)); + } + exports.ddescribe = ddescribe; + function xdescribe() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i - 0] = arguments[_i]; + } + return _describe.apply(void 0, [jsmXDescribe].concat(args)); + } + exports.xdescribe = xdescribe; + function beforeEach(fn) { + if (runnerStack.length > 0) { + runnerStack[runnerStack.length - 1].beforeEach(fn); + } else { + jsmBeforeEach(fn); + } + } + exports.beforeEach = beforeEach; + function beforeEachBindings(fn) { + jsmBeforeEach(function() { + var bindings = fn(); + if (!bindings) + return ; + testBindings = testBindings.concat(bindings); + }); + } + exports.beforeEachBindings = beforeEachBindings; + function _it(jsmFn, name, testFn, testTimeOut) { + var runner = runnerStack[runnerStack.length - 1]; + var timeOut = lang_1.Math.max(globalTimeOut, testTimeOut); + if (testFn instanceof test_injector_1.FunctionWithParamTokens) { + if (testFn.hasToken(AsyncTestCompleter)) { + jsmFn(name, function(done) { + var completerBinding = di_1.bind(AsyncTestCompleter).toFactory(function() { + if (!inIt) + throw new Error('AsyncTestCompleter can only be injected in an "it()"'); + return new AsyncTestCompleter(done); + }); + var injector = test_injector_1.createTestInjector(testBindings.concat([completerBinding])); + runner.run(injector); + inIt = true; + testFn.execute(injector); + inIt = false; + }, timeOut); + } else { + jsmFn(name, function() { + var injector = test_injector_1.createTestInjector(testBindings); + runner.run(injector); + testFn.execute(injector); + }, timeOut); + } + } else { + if (testFn.length === 0) { + jsmFn(name, function() { + var injector = test_injector_1.createTestInjector(testBindings); + runner.run(injector); + testFn(); + }, timeOut); + } else { + jsmFn(name, function(done) { + var injector = test_injector_1.createTestInjector(testBindings); + runner.run(injector); + testFn(done); + }, timeOut); + } + } + } + function it(name, fn, timeOut) { + if (timeOut === void 0) { + timeOut = null; + } + return _it(jsmIt, name, fn, timeOut); + } + exports.it = it; + function xit(name, fn, timeOut) { + if (timeOut === void 0) { + timeOut = null; + } + return _it(jsmXIt, name, fn, timeOut); + } + exports.xit = xit; + function iit(name, fn, timeOut) { + if (timeOut === void 0) { + timeOut = null; + } + return _it(jsmIIt, name, fn, timeOut); + } + exports.iit = iit; + Map.prototype['jasmineToString'] = function() { + var m = this; + if (!m) { + return '' + m; + } + var res = []; + m.forEach(function(v, k) { + res.push(k + ":" + v); + }); + return "{ " + res.join(',') + " }"; + }; + _global.beforeEach(function() { + jasmine.addMatchers({ + toEqual: function(util, customEqualityTesters) { + return {compare: function(actual, expected) { + return {pass: util.equals(actual, expected, [compareMap])}; + }}; + function compareMap(actual, expected) { + if (actual instanceof Map) { + var pass = actual.size === expected.size; + if (pass) { + actual.forEach(function(v, k) { + pass = pass && util.equals(v, expected.get(k)); + }); + } + return pass; + } else { + return undefined; + } + } + }, + toBePromise: function() { + return {compare: function(actual, expectedClass) { + var pass = typeof actual === 'object' && typeof actual.then === 'function'; + return { + pass: pass, + get message() { + return 'Expected ' + actual + ' to be a promise'; + } + }; + }}; + }, + toBeAnInstanceOf: function() { + return {compare: function(actual, expectedClass) { + var pass = typeof actual === 'object' && actual instanceof expectedClass; + return { + pass: pass, + get message() { + return 'Expected ' + actual + ' to be an instance of ' + expectedClass; + } + }; + }}; + }, + toHaveText: function() { + return {compare: function(actual, expectedText) { + var actualText = elementText(actual); + return { + pass: actualText == expectedText, + get message() { + return 'Expected ' + actualText + ' to be equal to ' + expectedText; + } + }; + }}; + }, + toHaveCssClass: function() { + return { + compare: buildError(false), + negativeCompare: buildError(true) + }; + function buildError(isNot) { + return function(actual, className) { + return { + pass: dom_adapter_1.DOM.hasClass(actual, className) == !isNot, + get message() { + return "Expected " + actual.outerHTML + " " + (isNot ? 'not ' : '') + "to contain the CSS class \"" + className + "\""; + } + }; + }; + } + }, + toContainError: function() { + return {compare: function(actual, expectedText) { + var errorMessage = actual.toString(); + return { + pass: errorMessage.indexOf(expectedText) > -1, + get message() { + return 'Expected ' + errorMessage + ' to contain ' + expectedText; + } + }; + }}; + }, + toThrowErrorWith: function() { + return {compare: function(actual, expectedText) { + try { + actual(); + return { + pass: false, + get message() { + return "Was expected to throw, but did not throw"; + } + }; + } catch (e) { + var errorMessage = e.toString(); + return { + pass: errorMessage.indexOf(expectedText) > -1, + get message() { + return 'Expected ' + errorMessage + ' to contain ' + expectedText; + } + }; + } + }}; + }, + toImplement: function() { + return {compare: function(actualObject, expectedInterface) { + var objProps = Object.keys(actualObject.constructor.prototype); + var intProps = Object.keys(expectedInterface.prototype); + var missedMethods = []; + intProps.forEach(function(k) { + if (!actualObject.constructor.prototype[k]) + missedMethods.push(k); + }); + return { + pass: missedMethods.length == 0, + get message() { + return 'Expected ' + actualObject + ' to have the following methods: ' + missedMethods.join(", "); + } + }; + }}; + } + }); + }); + var SpyObject = (function() { + function SpyObject(type) { + if (type === void 0) { + type = null; + } + if (type) { + for (var prop in type.prototype) { + var m = null; + try { + m = type.prototype[prop]; + } catch (e) {} + if (typeof m === 'function') { + this.spy(prop); + } + } + } + } + SpyObject.prototype.noSuchMethod = function(args) {}; + SpyObject.prototype.spy = function(name) { + if (!this[name]) { + this[name] = this._createGuinnessCompatibleSpy(name); + } + return this[name]; + }; + SpyObject.prototype.prop = function(name, value) { + this[name] = value; + }; + SpyObject.stub = function(object, config, overrides) { + if (object === void 0) { + object = null; + } + if (config === void 0) { + config = null; + } + if (overrides === void 0) { + overrides = null; + } + if (!(object instanceof SpyObject)) { + overrides = config; + config = object; + object = new SpyObject(); + } + var m = collection_1.StringMapWrapper.merge(config, overrides); + collection_1.StringMapWrapper.forEach(m, function(value, key) { + object.spy(key).andReturn(value); + }); + return object; + }; + SpyObject.prototype._createGuinnessCompatibleSpy = function(name) { + var newSpy = jasmine.createSpy(name); + newSpy.andCallFake = newSpy.and.callFake; + newSpy.andReturn = newSpy.and.returnValue; + newSpy.reset = newSpy.calls.reset; + newSpy.and.returnValue(null); + return newSpy; + }; + return SpyObject; + })(); + exports.SpyObject = SpyObject; + function elementText(n) { + var hasNodes = function(n) { + var children = dom_adapter_1.DOM.childNodes(n); + return children && children.length > 0; + }; + if (n instanceof Array) { + return n.map(function(nn) { + return elementText(nn); + }).join(""); + } + if (dom_adapter_1.DOM.isCommentNode(n)) { + return ''; + } + if (dom_adapter_1.DOM.isElementNode(n) && dom_adapter_1.DOM.tagName(n) == 'CONTENT') { + return elementText(Array.prototype.slice.apply(dom_adapter_1.DOM.getDistributedNodes(n))); + } + if (dom_adapter_1.DOM.hasShadowRoot(n)) { + return elementText(dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.getShadowRoot(n))); + } + if (hasNodes(n)) { + return elementText(dom_adapter_1.DOM.childNodesAsList(n)); + } + return dom_adapter_1.DOM.getText(n); + } + function isInInnerZone() { + return lang_1.global.zone._innerZone === true; + } + exports.isInInnerZone = isInInnerZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/test", ["angular2/src/test_lib/test_lib", "angular2/src/test_lib/test_component_builder", "angular2/src/test_lib/test_injector", "angular2/src/test_lib/fake_async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/test_lib/test_lib")); + __export(require("angular2/src/test_lib/test_component_builder")); + __export(require("angular2/src/test_lib/test_injector")); + __export(require("angular2/src/test_lib/fake_async")); + global.define = __define; + return module.exports; +}); + +//# sourceMappingURL=test_lib.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/test_lib.dev.js.map b/2.0.0-snapshot/test_lib.dev.js.map new file mode 100644 index 0000000000..082e05d557 --- /dev/null +++ b/2.0.0-snapshot/test_lib.dev.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../dev/es5/angular2/src/core/render/xhr_mock.js","../dev/es5/angular2/src/router/location_strategy.js","../dev/es5/angular2/src/mock/mock_location_strategy.js","../dev/es5/angular2/src/mock/view_resolver_mock.js","../dev/es5/angular2/mock.js","../dev/es5/angular2/src/mock/animation_builder_mock.js","../dev/es5/angular2/src/mock/directive_resolver_mock.js","../dev/es5/angular2/src/mock/ng_zone_mock.js","../dev/es5/angular2/src/test_lib/utils.js","../dev/es5/angular2/src/web_workers/shared/api.js","../dev/es5/angular2/src/web_workers/shared/render_proto_view_ref_store.js","../dev/es5/angular2/src/web_workers/shared/render_view_with_fragments_store.js","../dev/es5/angular2/src/test_lib/fake_async.js","../dev/es5/angular2/src/web_workers/shared/serializer.js","../dev/es5/angular2/src/test_lib/test_component_builder.js","../dev/es5/angular2/src/test_lib/test_injector.js","../dev/es5/angular2/src/test_lib/test_lib.js","../dev/es5/angular2/test.js"],"names":[],"mappings":";AAAA,KAAK,SAAS,AAAC,CAAC,mCAAkC,CAAG,EAAC,8BAA6B,CAAE,sCAAoC,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,iCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA1Q,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC7B,YAAQ,AAAC,CAAC,OAAM,CAAG,OAAK,CAAC,CAAC;AAC1B,WAAS,QAAM,CAAC,AAAC,CAAE;AACf,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,cAAc,EAAI,GAAC,CAAC;AACvB,SAAG,aAAa,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAC1C,SAAG,UAAU,EAAI,GAAC,CAAC;IACvB;AAAA,AACA,UAAM,UAAU,IAAI,EAAI,UAAU,GAAE,CAAG;AACnC,AAAI,QAAA,CAAA,OAAM,EAAI,IAAI,gBAAc,AAAC,CAAC,GAAE,CAAC,CAAC;AACtC,SAAG,UAAU,KAAK,AAAC,CAAC,OAAM,CAAC,CAAC;AAC5B,WAAO,CAAA,OAAM,WAAW,AAAC,EAAC,CAAC;IAC/B,CAAC;AACD,UAAM,UAAU,OAAO,EAAI,UAAU,GAAE,CAAG,CAAA,QAAO,CAAG;AAChD,AAAI,QAAA,CAAA,WAAU,EAAI,IAAI,aAAW,AAAC,CAAC,GAAE,CAAG,SAAO,CAAC,CAAC;AACjD,SAAG,cAAc,KAAK,AAAC,CAAC,WAAU,CAAC,CAAC;IACxC,CAAC;AACD,UAAM,UAAU,KAAK,EAAI,UAAU,GAAE,CAAG,CAAA,QAAO,CAAG;AAAE,SAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAG,SAAO,CAAC,CAAC;IAAE,CAAC;AAC3F,UAAM,UAAU,MAAM,EAAI,UAAS,AAAC,CAAE;AAClC,SAAI,IAAG,UAAU,OAAO,IAAM,EAAA,CAAG;AAC7B,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,8BAA6B,CAAC,CAAC;MACxE;AAAA,AACA,OAAG;AACC,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,YAAW,YAAY,SAAS,AAAC,CAAC,IAAG,UAAU,CAAG,EAAA,CAAC,CAAC;AAClE,WAAG,gBAAgB,AAAC,CAAC,OAAM,CAAC,CAAC;MACjC,QAAS,IAAG,UAAU,OAAO,EAAI,EAAA,EAAE;AACnC,SAAG,+BAA+B,AAAC,EAAC,CAAC;IACzC,CAAC;AACD,UAAM,UAAU,+BAA+B,EAAI,UAAS,AAAC,CAAE;AAC3D,SAAI,IAAG,cAAc,OAAO,IAAM,EAAA;AAC9B,eAAM;AAAA,AACN,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,cAAc,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAChD,AAAI,UAAA,CAAA,WAAU,EAAI,CAAA,IAAG,cAAc,CAAE,CAAA,CAAC,CAAC;AACvC,WAAG,KAAK,AAAC,CAAC,WAAU,IAAI,CAAC,CAAC;MAC9B;AAAA,AACA,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,wBAAuB,EAAI,CAAA,YAAW,YAAY,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC,CAAC;IAC9G,CAAC;AACD,UAAM,UAAU,gBAAgB,EAAI,UAAU,OAAM,CAAG;AACnD,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,OAAM,IAAI,CAAC;AACrB,SAAI,IAAG,cAAc,OAAO,EAAI,EAAA,CAAG;AAC/B,AAAI,UAAA,CAAA,WAAU,EAAI,CAAA,IAAG,cAAc,CAAE,CAAA,CAAC,CAAC;AACvC,WAAI,WAAU,IAAI,GAAK,IAAE,CAAG;AACxB,qBAAW,YAAY,OAAO,AAAC,CAAC,IAAG,cAAc,CAAG,YAAU,CAAC,CAAC;AAChE,gBAAM,SAAS,AAAC,CAAC,WAAU,SAAS,CAAC,CAAC;AACtC,iBAAM;QACV;AAAA,MACJ;AAAA,AACA,SAAI,IAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAC,CAAG;AAC5B,AAAI,UAAA,CAAA,QAAO,EAAI,CAAA,IAAG,aAAa,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACzC,cAAM,SAAS,AAAC,CAAC,MAAK,eAAe,AAAC,CAAC,QAAO,CAAC,CAAC,CAAC;AACjD,eAAM;MACV;AAAA,AACA,UAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,qBAAoB,EAAI,IAAE,CAAC,CAAC;IACrE,CAAC;AACD,SAAO,QAAM,CAAC;EAClB,CAAC,AAAC,CAAC,KAAI,IAAI,CAAC,CAAC;AACb,QAAM,QAAQ,EAAI,QAAM,CAAC;AACzB,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC/B,WAAS,gBAAc,CAAE,GAAE,CAAG;AAC1B,SAAG,IAAI,EAAI,IAAE,CAAC;AACd,SAAG,UAAU,EAAI,CAAA,OAAM,eAAe,UAAU,AAAC,EAAC,CAAC;IACvD;AAAA,AACA,kBAAc,UAAU,SAAS,EAAI,UAAU,QAAO,CAAG;AACrD,SAAI,MAAK,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAG;AAC1B,WAAG,UAAU,OAAO,AAAC,CAAC,iBAAgB,EAAI,CAAA,IAAG,IAAI,CAAG,KAAG,CAAC,CAAC;MAC7D,KACK;AACD,WAAG,UAAU,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;MACpC;AAAA,IACJ,CAAC;AACD,kBAAc,UAAU,WAAW,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,QAAQ,CAAC;IAAE,CAAC;AACrF,SAAO,gBAAc,CAAC;EAC1B,CAAC,AAAC,EAAC,CAAC;AACJ,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC5B,WAAS,aAAW,CAAE,GAAE,CAAG,CAAA,QAAO,CAAG;AACjC,SAAG,IAAI,EAAI,IAAE,CAAC;AACd,SAAG,SAAS,EAAI,SAAO,CAAC;IAC5B;AAAA,AACA,SAAO,aAAW,CAAC;EACvB,CAAC,AAAC,EAAC,CAAC;AA3FJ,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA2FgB;AC5FnC,KAAK,SAAS,AAAC,CAAC,uCAAsC,CAAG,EAAC,qCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAxI,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,SAAO,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,yBAAwB,CAAC,CAAC;EACpE;AAAA,AAiBI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAChC,WAAS,iBAAe,CAAC,AAAC,CAAE,GAC5B;AAAA,AACA,mBAAe,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACpE,mBAAe,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACxF,mBAAe,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACvE,mBAAe,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACpE,mBAAe,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AAC5E,mBAAe,UAAU,YAAY,EAAI,UAAS,AAAC,CAAE;AAAE,UAAM,CAAA,SAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AAC3E,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AA/B3C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA+ByB;AChC5C,KAAK,SAAS,AAAC,CAAC,0CAAyC,CAAG,EAAC,gCAA+B,CAAE,wCAAsC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA9K,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACvD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAsC,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC1C,YAAQ,AAAC,CAAC,oBAAmB,CAAG,OAAK,CAAC,CAAC;AACvC,WAAS,qBAAmB,CAAC,AAAC,CAAE;AAC5B,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,iBAAiB,EAAI,IAAE,CAAC;AAC3B,SAAG,aAAa,EAAI,IAAE,CAAC;AACvB,SAAG,cAAc,EAAI,GAAC,CAAC;AACvB,SAAG,WAAW,EAAI,GAAC,CAAC;AACpB,SAAG,SAAS,EAAI,IAAI,CAAA,OAAM,aAAa,AAAC,EAAC,CAAC;IAC9C;AAAA,AACA,uBAAmB,UAAU,iBAAiB,EAAI,UAAU,GAAE,CAAG;AAC7D,SAAG,aAAa,EAAI,IAAE,CAAC;AACvB,YAAM,kBAAkB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,KAAG,CAAC,CAAC;IAC3D,CAAC;AACD,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,aAAa,CAAC;IAAE,CAAC;AAC/E,uBAAmB,UAAU,eAAe,EAAI,UAAU,QAAO,CAAG;AAChE,YAAM,kBAAkB,SAAS,AAAC,CAAC,IAAG,SAAS,CAAG,EAAE,KAAI,CAAG,SAAO,CAAE,CAAC,CAAC;IAC1E,CAAC;AACD,uBAAmB,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG,CAAA,KAAI,CAAG,CAAA,GAAE,CAAG;AAClE,SAAG,cAAc,EAAI,MAAI,CAAC;AAC1B,SAAG,aAAa,EAAI,IAAE,CAAC;AACvB,SAAG,WAAW,KAAK,AAAC,CAAC,GAAE,CAAC,CAAC;IAC7B,CAAC;AACD,uBAAmB,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AAAE,YAAM,kBAAkB,UAAU,AAAC,CAAC,IAAG,SAAS,CAAG,GAAC,CAAC,CAAC;IAAE,CAAC;AACrH,uBAAmB,UAAU,YAAY,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,iBAAiB,CAAC;IAAE,CAAC;AAC1F,uBAAmB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAC9C,SAAI,IAAG,WAAW,OAAO,EAAI,EAAA,CAAG;AAC5B,WAAG,WAAW,IAAI,AAAC,EAAC,CAAC;AACrB,AAAI,UAAA,CAAA,OAAM,EAAI,CAAA,IAAG,WAAW,OAAO,EAAI,EAAA,CAAA,CAAI,CAAA,IAAG,WAAW,CAAE,IAAG,WAAW,OAAO,EAAI,EAAA,CAAC,EAAI,GAAC,CAAC;AAC3F,WAAG,iBAAiB,AAAC,CAAC,OAAM,CAAC,CAAC;MAClC;AAAA,IACJ,CAAC;AACD,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,CAAC;AACxC,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AA1CnD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA0C8B;AC3CjD,KAAK,SAAS,AAAC,CAAC,sCAAqC,CAAG,EAAC,qCAAoC,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,6BAA2B,CAAE,2CAAyC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAArR,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAiB,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AACzE,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AACtC,YAAQ,AAAC,CAAC,gBAAe,CAAG,OAAK,CAAC,CAAC;AACnC,WAAS,iBAAe,CAAC,AAAC,CAAE;AACxB,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,OAAO,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACpC,SAAG,iBAAiB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAC9C,SAAG,WAAW,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACxC,SAAG,oBAAoB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;IACrD;AAAA,AAOA,mBAAe,UAAU,QAAQ,EAAI,UAAU,SAAQ,CAAG,CAAA,IAAG,CAAG;AAC5D,SAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,SAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAC,CAAC;IACpC,CAAC;AAOD,mBAAe,UAAU,kBAAkB,EAAI,UAAU,SAAQ,CAAG,CAAA,QAAO,CAAG;AAC1E,SAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,SAAG,iBAAiB,IAAI,AAAC,CAAC,SAAQ,CAAG,SAAO,CAAC,CAAC;IAClD,CAAC;AAQD,mBAAe,UAAU,sBAAsB,EAAI,UAAU,SAAQ,CAAG,CAAA,IAAG,CAAG,CAAA,EAAC,CAAG;AAC9E,SAAG,mBAAmB,AAAC,CAAC,SAAQ,CAAC,CAAC;AAClC,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,IAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACvD,SAAI,MAAK,QAAQ,AAAC,CAAC,SAAQ,CAAC,CAAG;AAC3B,gBAAQ,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAClC,WAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAG,UAAQ,CAAC,CAAC;MACtD;AAAA,AACA,cAAQ,IAAI,AAAC,CAAC,IAAG,CAAG,GAAC,CAAC,CAAC;IAC3B,CAAC;AAYD,mBAAe,UAAU,QAAQ,EAAI,UAAU,SAAQ,CAAG;AACtD,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,IAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACzC,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC;AACrB,aAAO,KAAG,CAAC;AAAA,AACf,SAAG,EAAI,CAAA,IAAG,OAAO,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACjC,SAAI,MAAK,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAG;AACtB,WAAG,EAAI,CAAA,MAAK,UAAU,QAAQ,KAAK,AAAC,CAAC,IAAG,CAAG,UAAQ,CAAC,CAAC;MACzD;AAAA,AACI,QAAA,CAAA,UAAS,EAAI,CAAA,IAAG,WAAW,CAAC;AAChC,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,IAAG,oBAAoB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACvD,SAAI,MAAK,UAAU,AAAC,CAAC,SAAQ,CAAC,CAAA,EAAK,CAAA,MAAK,UAAU,AAAC,CAAC,UAAS,CAAC,CAAG;AAC7D,iBAAS,EAAI,CAAA,YAAW,YAAY,MAAM,AAAC,CAAC,IAAG,WAAW,CAAC,CAAC;AAC5D,mBAAW,WAAW,QAAQ,AAAC,CAAC,SAAQ,CAAG,UAAU,EAAC,CAAG,CAAA,IAAG,CAAG;AAC3D,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,UAAS,QAAQ,AAAC,CAAC,IAAG,CAAC,CAAC;AACvC,aAAI,QAAO,GAAK,EAAC,CAAA,CAAG;AAChB,gBAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,sBAAqB,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,iCAA+B,CAAA,CAAI,CAAA,MAAK,UAAU,AAAC,CAAC,SAAQ,CAAC,CAAC,CAAC;UAC1J;AAAA,AACA,mBAAS,CAAE,QAAO,CAAC,EAAI,GAAC,CAAC;QAC7B,CAAC,CAAC;AACF,WAAG,EAAI,IAAI,CAAA,UAAS,aAAa,AAAC,CAAC;AAAE,iBAAO,CAAG,CAAA,IAAG,SAAS;AAAG,oBAAU,CAAG,CAAA,IAAG,YAAY;AAAG,mBAAS,CAAG,WAAS;AAAA,QAAE,CAAC,CAAC;MAC1H;AAAA,AACI,QAAA,CAAA,cAAa,EAAI,CAAA,IAAG,iBAAiB,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AACzD,SAAI,MAAK,UAAU,AAAC,CAAC,cAAa,CAAC,CAAG;AAClC,WAAG,EAAI,IAAI,CAAA,UAAS,aAAa,AAAC,CAAC;AAAE,iBAAO,CAAG,eAAa;AAAG,oBAAU,CAAG,KAAG;AAAG,mBAAS,CAAG,CAAA,IAAG,WAAW;AAAA,QAAE,CAAC,CAAC;MACpH;AAAA,AACA,SAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAC,CAAC;AACpC,WAAO,KAAG,CAAC;IACf,CAAC;AASD,mBAAe,UAAU,mBAAmB,EAAI,UAAU,SAAQ,CAAG;AACjE,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,IAAG,WAAW,IAAI,AAAC,CAAC,SAAQ,CAAC,CAAC;AAC3C,SAAI,MAAK,UAAU,AAAC,CAAC,MAAK,CAAC,CAAG;AAC1B,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,gBAAe,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,SAAQ,CAAC,CAAA,CAAI,mEAAiE,CAAC,CAAC;MAC7J;AAAA,IACJ,CAAC;AACD,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,CAAC,eAAc,aAAa,CAAC,CAAC;AAChC,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AA/G3C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA+G0B;AChH7C,KAAK,SAAS,AAAC,CAAC,eAAc,CAAG,EAAC,0CAAyC,CAAE,wCAAsC,CAAE,uCAAqC,CAAE,oCAAkC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAxO,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,SAAS,SAAO,CAAE,CAAA,CAAG;AACjB,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAC,OAAM,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,cAAM,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,EACtE;AAAA,AACA,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,0CAAkC,CAAC,CAAC,CAAC;AACtD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAA+B,CAAC,CAAC;AACnE,QAAM,iBAAiB,EAAI,CAAA,mBAAkB,iBAAiB,CAAC;AAC/D,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,sCAAqC,CAAC,CAAC;AAC1E,QAAM,iBAAiB,EAAI,CAAA,oBAAmB,iBAAiB,CAAC;AAChE,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAC7D,QAAM,QAAQ,EAAI,CAAA,UAAS,QAAQ,CAAC;AATpC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AASY;ACV/B,KAAK,SAAS,AAAC,CAAC,0CAAyC,CAAG,EAAC,sBAAqB,CAAE,yCAAuC,CAAE,6CAA2C,CAAE,iCAA+B,CAAE,uCAAqC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA1R,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,wCAAuC,CAAC,CAAC;AAC3E,AAAI,IAAA,CAAA,uBAAsB,EAAI,CAAA,OAAM,AAAC,CAAC,4CAA2C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AAC3D,AAAI,IAAA,CAAA,iBAAgB,EAAI,CAAA,OAAM,AAAC,CAAC,sCAAqC,CAAC,CAAC;AACvE,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC1C,YAAQ,AAAC,CAAC,oBAAmB,CAAG,OAAK,CAAC,CAAC;AACvC,WAAS,qBAAmB,CAAC,AAAC,CAAE;AAC5B,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC;IAC3B;AAAA,AACA,uBAAmB,UAAU,IAAI,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,IAAI,wBAAsB,AAAC,EAAC,CAAC;IAAE,CAAC;AAC1F,uBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,GAAC,CAAC,CACtC,CAAG,qBAAmB,CAAC,CAAC;AACxB,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,CAAC;AACxC,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AACnD,AAAI,IAAA,CAAA,uBAAsB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC7C,YAAQ,AAAC,CAAC,uBAAsB,CAAG,OAAK,CAAC,CAAC;AAC1C,WAAS,wBAAsB,CAAC,AAAC,CAAE;AAC/B,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC;IAC3B;AAAA,AACA,0BAAsB,UAAU,MAAM,EAAI,UAAU,OAAM,CAAG;AAAE,WAAO,IAAI,cAAY,AAAC,CAAC,OAAM,CAAG,CAAA,IAAG,KAAK,CAAC,CAAC;IAAE,CAAC;AAC9G,SAAO,wBAAsB,CAAC;EAClC,CAAC,AAAC,CAAC,uBAAsB,oBAAoB,CAAC,CAAC;AAC/C,AAAI,IAAA,CAAA,sBAAqB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC5C,YAAQ,AAAC,CAAC,sBAAqB,CAAG,OAAK,CAAC,CAAC;AACzC,WAAS,uBAAqB,CAAC,AAAC,CAAE;AAC9B,WAAK,MAAM,AAAC,CAAC,IAAG,CAAG,UAAQ,CAAC,CAAC;IACjC;AAAA,AACA,yBAAqB,UAAU,6BAA6B,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,yBAAyB,EAAI,MAAI,CAAC;IAAE,CAAC;AACtH,SAAO,uBAAqB,CAAC;EACjC,CAAC,AAAC,CAAC,iBAAgB,eAAe,CAAC,CAAC;AACpC,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AACnC,YAAQ,AAAC,CAAC,aAAY,CAAG,OAAK,CAAC,CAAC;AAChC,WAAS,cAAY,CAAE,OAAM,CAAG,CAAA,IAAG,CAAG;AAClC,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,QAAM,CAAG,KAAG,CAAG,IAAI,uBAAqB,AAAC,EAAC,CAAC,CAAC;IAClE;AAAA,AACA,gBAAY,UAAU,KAAK,EAAI,UAAU,QAAO,CAAG;AAAE,SAAG,UAAU,EAAI,SAAO,CAAC;IAAE,CAAC;AACjF,gBAAY,UAAU,MAAM,EAAI,UAAS,AAAC,CAAE;AACxC,SAAG,UAAU,AAAC,CAAC,CAAA,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,KAAG,CAAC;IACzB,CAAC;AACD,SAAO,cAAY,CAAC;EACxB,CAAC,AAAC,CAAC,WAAU,UAAU,CAAC,CAAC;AA9DzB,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA8D8B;AC/DjD,KAAK,SAAS,AAAC,CAAC,2CAA0C,CAAG,EAAC,qCAAoC,CAAE,gCAA8B,CAAE,6BAA2B,CAAE,gDAA8C,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAzP,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,4BAAiB,CAAC,CAAC;AAC5C,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA8C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,qBAAoB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC3C,YAAQ,AAAC,CAAC,qBAAoB,CAAG,OAAK,CAAC,CAAC;AACxC,WAAS,sBAAoB,CAAC,AAAC,CAAE;AAC7B,WAAK,MAAM,AAAC,CAAC,IAAG,CAAG,UAAQ,CAAC,CAAC;AAC7B,SAAG,mBAAmB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAChD,SAAG,uBAAuB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;IACxD;AAAA,AACA,wBAAoB,UAAU,QAAQ,EAAI,UAAU,IAAG,CAAG;AACtD,AAAI,QAAA,CAAA,EAAC,EAAI,CAAA,MAAK,UAAU,QAAQ,KAAK,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC;AAClD,AAAI,QAAA,CAAA,gBAAe,EAAI,CAAA,IAAG,mBAAmB,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AACxD,AAAI,QAAA,CAAA,oBAAmB,EAAI,CAAA,IAAG,uBAAuB,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AAChE,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,EAAC,SAAS,CAAC;AAC1B,SAAI,MAAK,UAAU,AAAC,CAAC,gBAAe,CAAC,CAAG;AACpC,eAAO,EAAI,CAAA,EAAC,SAAS,OAAO,AAAC,CAAC,gBAAe,CAAC,CAAC;MACnD;AAAA,AACA,SAAI,EAAC,WAAa,CAAA,UAAS,kBAAkB,CAAG;AAC5C,AAAI,UAAA,CAAA,YAAW,EAAI,CAAA,EAAC,aAAa,CAAC;AAClC,WAAI,MAAK,UAAU,AAAC,CAAC,oBAAmB,CAAC,CAAG;AACxC,qBAAW,EAAI,CAAA,EAAC,aAAa,OAAO,AAAC,CAAC,oBAAmB,CAAC,CAAC;QAC/D;AAAA,AACA,aAAO,IAAI,CAAA,UAAS,kBAAkB,AAAC,CAAC;AACpC,iBAAO,CAAG,CAAA,EAAC,SAAS;AACpB,mBAAS,CAAG,CAAA,EAAC,WAAW;AACxB,eAAK,CAAG,CAAA,EAAC,OAAO;AAChB,aAAG,CAAG,CAAA,EAAC,KAAK;AACZ,iBAAO,CAAG,SAAO;AACjB,iBAAO,CAAG,CAAA,EAAC,SAAS;AACpB,iBAAO,CAAG,CAAA,EAAC,SAAS;AACpB,wBAAc,CAAG,CAAA,EAAC,gBAAgB;AAClC,gBAAM,CAAG,CAAA,EAAC,QAAQ;AAClB,wBAAc,CAAG,CAAA,EAAC,gBAAgB;AAClC,qBAAW,CAAG,aAAW;AAAA,QAC7B,CAAC,CAAC;MACN;AAAA,AACA,WAAO,IAAI,CAAA,UAAS,kBAAkB,AAAC,CAAC;AACpC,eAAO,CAAG,CAAA,EAAC,SAAS;AACpB,iBAAS,CAAG,CAAA,EAAC,WAAW;AACxB,aAAK,CAAG,CAAA,EAAC,OAAO;AAChB,WAAG,CAAG,CAAA,EAAC,KAAK;AACZ,eAAO,CAAG,SAAO;AACjB,eAAO,CAAG,CAAA,EAAC,SAAS;AACpB,eAAO,CAAG,CAAA,EAAC,SAAS;AACpB,sBAAc,CAAG,CAAA,EAAC,gBAAgB;AAClC,cAAM,CAAG,CAAA,EAAC,QAAQ;AAAA,MACtB,CAAC,CAAC;IACN,CAAC;AACD,wBAAoB,UAAU,oBAAoB,EAAI,UAAU,IAAG,CAAG,CAAA,QAAO,CAAG;AAC5E,SAAG,mBAAmB,IAAI,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;IAC/C,CAAC;AACD,wBAAoB,UAAU,wBAAwB,EAAI,UAAU,IAAG,CAAG,CAAA,YAAW,CAAG;AACpF,SAAG,uBAAuB,IAAI,AAAC,CAAC,IAAG,CAAG,aAAW,CAAC,CAAC;IACvD,CAAC;AACD,SAAO,sBAAoB,CAAC;EAChC,CAAC,AAAC,CAAC,oBAAmB,kBAAkB,CAAC,CAAC;AAC1C,QAAM,sBAAsB,EAAI,sBAAoB,CAAC;AAhErD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAgE+B;ACjElD,KAAK,SAAS,AAAC,CAAC,gCAA+B,CAAG,EAAC,gCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA5H,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACzD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAChC,YAAQ,AAAC,CAAC,UAAS,CAAG,OAAK,CAAC,CAAC;AAC7B,WAAS,WAAS,CAAC,AAAC,CAAE;AAClB,WAAK,KAAK,AAAC,CAAC,IAAG,CAAG,EAAE,oBAAmB,CAAG,MAAI,CAAE,CAAC,CAAC;IACtD;AAAA,AACA,aAAS,UAAU,IAAI,EAAI,UAAU,EAAC,CAAG;AAAE,WAAO,CAAA,EAAC,AAAC,EAAC,CAAC;IAAE,CAAC;AACzD,aAAS,UAAU,kBAAkB,EAAI,UAAU,EAAC,CAAG;AAAE,WAAO,CAAA,EAAC,AAAC,EAAC,CAAC;IAAE,CAAC;AACvE,aAAS,UAAU,oBAAoB,EAAI,UAAU,EAAC,CAAG,CAAA,gBAAe,CAAG;AACvE,SAAI,gBAAe,IAAM,KAAK,EAAA,CAAG;AAAE,uBAAe,EAAI,MAAI,CAAC;MAAE;AAAA,AAC7D,SAAG,aAAa,EAAI,GAAC,CAAC;IAC1B,CAAC;AACD,aAAS,UAAU,iBAAiB,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,aAAa,AAAC,EAAC,CAAC;IAAE,CAAC;AAC5E,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,CAAC,SAAQ,OAAO,CAAC,CAAC;AACpB,QAAM,WAAW,EAAI,WAAS,CAAC;AArB/B,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAqBoB;ACtBvC,KAAK,SAAS,AAAC,CAAC,6BAA4B,CAAG,EAAC,qCAAoC,CAAE,oCAAkC,CAAE,gCAA8B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAlM,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,GAAE,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACnB,WAAS,IAAE,CAAC,AAAC,CAAE;AACX,SAAG,QAAQ,EAAI,GAAC,CAAC;IACrB;AAAA,AACA,MAAE,UAAU,IAAI,EAAI,UAAU,KAAI,CAAG;AAAE,SAAG,QAAQ,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;IAAE,CAAC;AAClE,MAAE,UAAU,GAAG,EAAI,UAAU,KAAI,CAAG;AAChC,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,WAAO,UAAU,EAAC,CAAG,CAAA,EAAC,CAAG,CAAA,EAAC,CAAG,CAAA,EAAC,CAAG,CAAA,EAAC,CAAG;AACjC,WAAI,EAAC,IAAM,KAAK,EAAA,CAAG;AAAE,WAAC,EAAI,KAAG,CAAC;QAAE;AAAA,AAChC,WAAI,EAAC,IAAM,KAAK,EAAA,CAAG;AAAE,WAAC,EAAI,KAAG,CAAC;QAAE;AAAA,AAChC,WAAI,EAAC,IAAM,KAAK,EAAA,CAAG;AAAE,WAAC,EAAI,KAAG,CAAC;QAAE;AAAA,AAChC,WAAI,EAAC,IAAM,KAAK,EAAA,CAAG;AAAE,WAAC,EAAI,KAAG,CAAC;QAAE;AAAA,AAChC,WAAI,EAAC,IAAM,KAAK,EAAA,CAAG;AAAE,WAAC,EAAI,KAAG,CAAC;QAAE;AAAA,AAChC,YAAI,QAAQ,KAAK,AAAC,CAAC,KAAI,CAAC,CAAC;MAC7B,CAAC;IACL,CAAC;AACD,MAAE,UAAU,MAAM,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,QAAQ,EAAI,GAAC,CAAC;IAAE,CAAC;AACxD,MAAE,UAAU,OAAO,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,YAAW,YAAY,KAAK,AAAC,CAAC,IAAG,QAAQ,CAAG,KAAG,CAAC,CAAC;IAAE,CAAC;AAChG,SAAO,IAAE,CAAC;EACd,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,IAAI,EAAI,IAAE,CAAC;AACjB,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAChC,WAAS,iBAAe,CAAE,EAAC,CAAG;AAC1B,SAAI,MAAK,UAAU,AAAC,CAAC,EAAC,CAAC,CAAG;AACtB,WAAG,IAAI,EAAI,GAAC,CAAC;MACjB,KACK;AACD,WAAG,IAAI,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,aAAY,IAAI,CAAC,CAAA,CAAI,CAAA,aAAY,IAAI,aAAa,AAAC,EAAC,CAAA,CAAI,GAAC,CAAC;MAC1F;AAAA,IACJ;AAAA,AACA,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,YAAU,CAAG;AAC3D,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,SAAQ,CAAC,CAAA,CAAI,EAAC,CAAA,CAAC;MAAE;AAC5D,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,YAAU,CAAG;AAC3D,QAAE,CAAG,UAAS,AAAC,CAAE;AACb,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAAK,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,SAAQ,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAC1E,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAAK,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAA,EAAK,EAAC,CAAA,CAAC;MAChF;AACA,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,SAAO,CAAG;AACxD,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAA,CAAI,EAAC,CAAA,CAAC;MAAE;AACzD,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,OAAK,CAAG;AACtD,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,SAAQ,CAAC,CAAA,CAAI,EAAC,CAAA,CAAC;MAAE;AAC5D,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,WAAS,CAAG;AAC1D,QAAE,CAAG,UAAS,AAAC,CAAE;AACb,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAAK,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAA,EAAK,EAAC,CAAA,CAAC;MACjF;AACA,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,SAAO,CAAG;AACxD,QAAE,CAAG,UAAS,AAAC,CAAE;AACb,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,aAAY,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAAK,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,WAAU,CAAC,CAAA,CAAI,EAAC,CAAA,CAAC;MACrF;AACA,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,SAAO,CAAG;AACxD,QAAE,CAAG,UAAS,AAAC,CAAE;AAAE,aAAO,CAAA,IAAG,UAAU,GAAK,CAAA,IAAG,KAAK,CAAA,EAAK,CAAA,IAAG,OAAO,CAAC;MAAE;AACtE,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAK,eAAe,AAAC,CAAC,gBAAe,UAAU,CAAG,kBAAgB,CAAG;AAIjE,QAAE,CAAG,UAAS,AAAC,CAAE;AACb,aAAO,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,UAAS,CAAC,CAAA,CAAI,EAAC,CAAA,CAAA,EAAK,CAAA,IAAG,IAAI,QAAQ,AAAC,CAAC,MAAK,CAAC,CAAA,EAAK,EAAC,CAAA,CAAC;MAC9E;AACA,eAAS,CAAG,KAAG;AACf,iBAAW,CAAG,KAAG;AAAA,IACrB,CAAC,CAAC;AACF,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AAC3C,QAAM,iBAAiB,EAAI,IAAI,iBAAe,AAAC,CAAC,IAAG,CAAC,CAAC;AACrD,SAAS,cAAY,CAAE,OAAM,CAAG,CAAA,SAAQ,CAAG;AACvC,gBAAY,IAAI,cAAc,AAAC,CAAC,OAAM,CAAG,CAAA,aAAY,IAAI,YAAY,AAAC,CAAC,SAAQ,CAAC,CAAC,CAAC;EACtF;AAAA,AACA,QAAM,cAAc,EAAI,cAAY,CAAC;AACrC,SAAS,GAAC,CAAE,IAAG,CAAG;AACd,SAAO,CAAA,aAAY,IAAI,WAAW,AAAC,CAAC,aAAY,IAAI,QAAQ,AAAC,CAAC,aAAY,IAAI,eAAe,AAAC,CAAC,IAAG,CAAC,CAAC,CAAC,CAAC;EAC1G;AAAA,AACA,QAAM,GAAG,EAAI,GAAC,CAAC;AACf,AAAI,IAAA,CAAA,iBAAgB,EAAI,EAAC,GAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,KAAG,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAG,IAAE,CAAC,CAAC;AACzG,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,MAAK,cAAc,OAAO,AAAC,CAAC,KAAI,EAAI,CAAA,iBAAgB,KAAK,AAAC,CAAC,IAAG,CAAC,CAAA,CAAI,IAAE,CAAC,CAAC;AACxF,SAAS,eAAa,CAAE,KAAI,CAAG;AAC3B,SAAO,CAAA,MAAK,cAAc,OAAO,AAAC,CAAC,MAAK,cAAc,iBAAiB,AAAC,CAAC,KAAI,CAAG,WAAS,CAAG,UAAU,KAAI,CAAG;AAAE,WAAO,EAAC,IAAG,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAC,CAAC;IAAE,CAAC,CAAC,CAAC;EAChJ;AAAA,AACA,QAAM,eAAe,EAAI,eAAa,CAAC;AACvC,SAAS,aAAW,CAAE,GAAE,CAAG;AACvB,MAAE,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,GAAE,CAAG,OAAK,CAAG,IAAE,CAAC,CAAC;AACvD,MAAE,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,GAAE,CAAG,OAAK,CAAG,IAAE,CAAC,CAAC;AACvD,MAAE,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,GAAE,CAAG,KAAG,CAAG,IAAE,CAAC,CAAC;AACrD,MAAE,EAAI,CAAA,MAAK,cAAc,WAAW,AAAC,CAAC,GAAE,CAAG,MAAI,CAAG,IAAE,CAAC,CAAC;AACtD,MAAE,EAAI,CAAA,MAAK,cAAc,iBAAiB,AAAC,CAAC,GAAE,CAAG,oBAAkB,CAAG,UAAU,KAAI,CAAG;AAAE,WAAO,EAAC,MAAK,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAA,CAAI,IAAE,CAAC,CAAC;IAAE,CAAC,CAAC;AAC7H,MAAE,EAAI,CAAA,MAAK,cAAc,iBAAiB,AAAC,CAAC,GAAE,CAAG,sBAAoB,CAAG,UAAU,KAAI,CAAG;AAAE,WAAO,EAAC,GAAE,EAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAA,CAAI,MAAI,CAAA,CAAI,CAAA,KAAI,CAAE,CAAA,CAAC,CAAA,CAAI,MAAI,CAAC,CAAC;IAAE,CAAC,CAAC;AACjJ,SAAO,IAAE,CAAC;EACd;AAAA,AACA,QAAM,aAAa,EAAI,aAAW,CAAC;AACnC,AAAI,IAAA,CAAA,mBAAkB,EAAI,EAAC,IAAG,CAAG,KAAG,CAAG,QAAM,CAAC,CAAC;AAC/C,SAAS,iBAAe,CAAE,EAAC,CAAG;AAC1B,AAAI,MAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,OAAI,aAAY,IAAI,cAAc,AAAC,CAAC,EAAC,CAAC,CAAG;AACrC,AAAI,QAAA,CAAA,OAAM,EAAI,CAAA,MAAK,cAAc,YAAY,AAAC,CAAC,aAAY,IAAI,QAAQ,AAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAE7E,WAAK,GAAK,CAAA,GAAE,EAAI,QAAM,CAAC;AAEvB,AAAI,QAAA,CAAA,YAAW,EAAI,CAAA,aAAY,IAAI,aAAa,AAAC,CAAC,EAAC,CAAC,CAAC;AACrD,AAAI,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,iBAAW,WAAW,QAAQ,AAAC,CAAC,YAAW,CAAG,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,WAAG,KAAK,AAAC,CAAC,CAAA,CAAC,CAAC;MAAE,CAAC,CAAC;AAChF,iBAAW,YAAY,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACnC,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,IAAG,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AAClC,AAAI,UAAA,CAAA,GAAE,EAAI,CAAA,IAAG,CAAE,CAAA,CAAC,CAAC;AACjB,AAAI,UAAA,CAAA,QAAO,EAAI,CAAA,YAAW,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACpC,WAAI,CAAC,MAAK,SAAS,AAAC,CAAC,QAAO,CAAC,CAAG;AAC5B,eAAK,GAAK,CAAA,GAAE,EAAI,IAAE,CAAC;QACvB,KACK;AACD,eAAK,GAAK,CAAA,GAAE,EAAI,IAAE,CAAA,CAAI,MAAI,CAAA,CAAI,SAAO,CAAA,CAAI,KAAG,CAAC;QACjD;AAAA,MACJ;AAAA,AACA,WAAK,GAAK,IAAE,CAAC;AAEb,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,aAAY,IAAI,WAAW,AAAC,CAAC,aAAY,IAAI,kBAAkB,AAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AACpF,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,QAAO,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACtC,aAAK,GAAK,CAAA,gBAAe,AAAC,CAAC,QAAO,CAAE,CAAA,CAAC,CAAC,CAAC;MAC3C;AAAA,AAEA,SAAI,CAAC,YAAW,YAAY,SAAS,AAAC,CAAC,mBAAkB,CAAG,QAAM,CAAC,CAAG;AAClE,aAAK,GAAK,CAAA,IAAG,EAAI,QAAM,CAAA,CAAI,IAAE,CAAC;MAClC;AAAA,IACJ,KACK,KAAI,aAAY,IAAI,cAAc,AAAC,CAAC,EAAC,CAAC,CAAG;AAC1C,WAAK,GAAK,CAAA,MAAK,EAAI,CAAA,aAAY,IAAI,UAAU,AAAC,CAAC,EAAC,CAAC,CAAA,CAAI,MAAI,CAAC;IAC9D,KACK;AACD,WAAK,GAAK,CAAA,aAAY,IAAI,QAAQ,AAAC,CAAC,EAAC,CAAC,CAAC;IAC3C;AAAA,AACA,SAAO,OAAK,CAAC;EACjB;AAAA,AACA,QAAM,iBAAiB,EAAI,iBAAe,CAAC;AA1J3C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA0Ja;AC3JhC,KAAK,SAAS,AAAC,CAAC,qCAAoC,CAAG,EAAC,+BAA8B,CAAE,uBAAqB,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAvJ,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,QAAM,cAAc,EAAI,CAAA,MAAK,WAAW,AAAC,CAAC,GAAI,CAAA,IAAG,YAAY,AAAC,CAAC,uBAAsB,CAAC,CAAC,CAAC;AACxF,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACnC,WAAS,oBAAkB,CAAE,UAAS,CAAG,CAAA,uBAAsB,CAAG;AAC9D,SAAG,WAAW,EAAI,WAAS,CAAC;AAC5B,SAAG,wBAAwB,EAAI,wBAAsB,CAAC;IAC1D;AAAA,AACA,SAAO,oBAAkB,CAAC;EAC9B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,oBAAoB,EAAI,oBAAkB,CAAC;AAVjD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAUW;ACX9B,KAAK,SAAS,AAAC,CAAC,6DAA4D,CAAG,EAAC,sBAAqB,CAAE,+BAA6B,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAApN,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,SAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,cAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;IAAE,CAAA;EACxE,CAAC;AACD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAC1D,AAAI,IAAA,CAAA,uBAAsB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACvC,WAAS,wBAAsB,CAAE,WAAU,CAAG;AAC1C,SAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC/B,SAAG,mBAAmB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACnC,SAAG,WAAW,EAAI,EAAA,CAAC;AACnB,SAAG,aAAa,EAAI,YAAU,CAAC;IACnC;AAAA,AACA,0BAAsB,UAAU,wBAAwB,EAAI,UAAU,GAAE,CAAG;AACvE,SAAI,IAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAC,CAAG;AAClC,aAAO,CAAA,IAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;MAC3C,KACK;AACD,WAAG,eAAe,IAAI,AAAC,CAAC,IAAG,WAAW,CAAG,IAAE,CAAC,CAAC;AAC7C,WAAG,mBAAmB,IAAI,AAAC,CAAC,GAAE,CAAG,CAAA,IAAG,WAAW,CAAC,CAAC;AACjD,aAAO,CAAA,IAAG,WAAW,EAAE,CAAC;MAC5B;AAAA,IACJ,CAAC;AACD,0BAAsB,UAAU,2BAA2B,EAAI,UAAU,KAAI,CAAG;AAC5E,WAAO,CAAA,IAAG,eAAe,IAAI,AAAC,CAAC,KAAI,CAAC,CAAC;IACzC,CAAC;AACD,0BAAsB,UAAU,YAAY,EAAI,UAAU,KAAI,CAAG;AAC7D,SAAI,KAAI,GAAK,KAAG,CAAG;AACf,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,IAAG,aAAa,CAAG;AACnB,aAAO,IAAI,4BAA0B,AAAC,CAAC,KAAI,CAAC,CAAC;MACjD,KACK;AACD,aAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,KAAI,CAAC,CAAC;MACjD;AAAA,IACJ,CAAC;AACD,0BAAsB,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG;AACzD,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,IAAG,aAAa,CAAG;AACnB,aAAO,CAAA,GAAE,UAAU,CAAC;MACxB,KACK;AACD,aAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC5C;AAAA,IACJ,CAAC;AACD,0BAAsB,EAAI,CAAA,UAAS,AAAC,CAAC,CACjC,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,OAAO,AAAC,CAAC,KAAI,cAAc,CAAC,CAAC,CAC3C,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,wBAAsB,CAAC,CAAC;AAC3B,SAAO,wBAAsB,CAAC;EAClC,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,wBAAwB,EAAI,wBAAsB,CAAC;AACzD,AAAI,IAAA,CAAA,2BAA0B,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AACjD,YAAQ,AAAC,CAAC,2BAA0B,CAAG,OAAK,CAAC,CAAC;AAC9C,WAAS,4BAA0B,CAAE,SAAQ,CAAG;AAC5C,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,UAAQ,CAAC;IAC9B;AAAA,AACA,SAAO,4BAA0B,CAAC;EACtC,CAAC,AAAC,CAAC,KAAI,mBAAmB,CAAC,CAAC;AAC5B,QAAM,4BAA4B,EAAI,4BAA0B,CAAC;AAjFjE,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAiFmC;AClFtD,KAAK,SAAS,AAAC,CAAC,kEAAiE,CAAG,EAAC,sBAAqB,CAAE,+BAA6B,CAAE,sCAAoC,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAA/P,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,UAAU,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AACxD,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAA,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,QAAA,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,AACrD,WAAS,GAAC,CAAC,AAAC,CAAE;AAAE,SAAG,YAAY,EAAI,EAAA,CAAC;IAAE;AAAA,AACtC,KAAC,UAAU,EAAI,CAAA,CAAA,UAAU,CAAC;AAC1B,IAAA,UAAU,EAAI,IAAI,GAAC,AAAC,EAAC,CAAC;EAC1B,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,QAAQ,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,SAAQ,CAAG;AACrE,SAAO,UAAU,MAAK,CAAG,CAAA,GAAE,CAAG;AAAE,cAAQ,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,WAAS,CAAC,CAAC;IAAE,CAAA;EACxE,CAAC;AACD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAC1D,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,4BAA2B,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC5C,WAAS,6BAA2B,CAAE,WAAU,CAAG;AAC/C,SAAG,WAAW,EAAI,EAAA,CAAC;AACnB,SAAG,aAAa,EAAI,YAAU,CAAC;AAC/B,SAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC/B,SAAG,cAAc,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AAC9B,SAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;IACnC;AAAA,AACA,+BAA2B,UAAU,SAAS,EAAI,UAAU,aAAY,CAAG;AACvE,AAAI,QAAA,CAAA,YAAW,EAAI,CAAA,IAAG,WAAW,CAAC;AAClC,AAAI,QAAA,CAAA,OAAM,EAAI,IAAI,uBAAqB,AAAC,CAAC,IAAG,WAAW,EAAE,CAAC,CAAC;AAC3D,AAAI,QAAA,CAAA,YAAW,EAAI,CAAA,YAAW,YAAY,mBAAmB,AAAC,CAAC,aAAY,CAAC,CAAC;AAC7E,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,cAAY,CAAG,CAAA,CAAA,EAAE,CAAG;AACpC,mBAAW,CAAE,CAAA,CAAC,EAAI,IAAI,2BAAyB,AAAC,CAAC,IAAG,WAAW,EAAE,CAAC,CAAC;MACvE;AAAA,AACI,QAAA,CAAA,uBAAsB,EAAI,IAAI,CAAA,KAAI,wBAAwB,AAAC,CAAC,OAAM,CAAG,aAAW,CAAC,CAAC;AACtF,SAAG,MAAM,AAAC,CAAC,uBAAsB,CAAG,aAAW,CAAC,CAAC;AACjD,WAAO,wBAAsB,CAAC;IAClC,CAAC;AACD,+BAA2B,UAAU,MAAM,EAAI,UAAU,IAAG,CAAG,CAAA,UAAS,CAAG;AACvE,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAG,eAAe,IAAI,AAAC,CAAC,UAAS,CAAG,CAAA,IAAG,QAAQ,CAAC,CAAC;AACjD,SAAG,cAAc,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAG,WAAS,CAAC,CAAC;AAChD,eAAS,EAAE,CAAC;AACZ,iBAAW,YAAY,QAAQ,AAAC,CAAC,IAAG,aAAa,CAAG,UAAU,GAAE,CAAG;AAC/D,YAAI,eAAe,IAAI,AAAC,CAAC,UAAS,CAAG,IAAE,CAAC,CAAC;AACzC,YAAI,cAAc,IAAI,AAAC,CAAC,GAAE,CAAG,WAAS,CAAC,CAAC;AACxC,iBAAS,EAAE,CAAC;MAChB,CAAC,CAAC;AACF,SAAG,eAAe,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAG,CAAA,IAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;AACD,+BAA2B,UAAU,OAAO,EAAI,UAAU,IAAG,CAAG;AAC5D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAG,WAAW,AAAC,CAAC,IAAG,CAAC,CAAC;AACrB,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,IAAG,eAAe,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;AAC7C,cAAQ,QAAQ,AAAC,CAAC,SAAU,QAAO,CAAG;AAAE,YAAI,WAAW,AAAC,CAAC,QAAO,CAAC,CAAC;MAAE,CAAC,CAAC;AACtE,iBAAW,WAAW,OAAO,AAAC,CAAC,IAAG,eAAe,CAAG,KAAG,CAAC,CAAC;IAC7D,CAAC;AACD,+BAA2B,UAAU,WAAW,EAAI,UAAU,GAAE,CAAG;AAC/D,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;AACvC,iBAAW,WAAW,OAAO,AAAC,CAAC,IAAG,cAAc,CAAG,IAAE,CAAC,CAAC;AACvD,iBAAW,WAAW,OAAO,AAAC,CAAC,IAAG,eAAe,CAAG,MAAI,CAAC,CAAC;IAC9D,CAAC;AACD,+BAA2B,UAAU,uBAAuB,EAAI,UAAU,OAAM,CAAG;AAC/E,WAAO,CAAA,IAAG,kCAAkC,AAAC,CAAC,OAAM,CAAC,CAAC;IAC1D,CAAC;AACD,+BAA2B,UAAU,2BAA2B,EAAI,UAAU,WAAU,CAAG;AACvF,WAAO,CAAA,IAAG,kCAAkC,AAAC,CAAC,WAAU,CAAC,CAAC;IAC9D,CAAC;AACD,+BAA2B,UAAU,yBAAyB,EAAI,UAAU,GAAE,CAAG;AAC7E,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACA,WAAO,CAAA,IAAG,UAAU,AAAC,CAAC,GAAE,CAAC,CAAC;IAC9B,CAAC;AACD,+BAA2B,UAAU,6BAA6B,EAAI,UAAU,GAAE,CAAG;AACjF,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACA,WAAO,CAAA,IAAG,UAAU,AAAC,CAAC,GAAE,CAAC,CAAC;IAC9B,CAAC;AACD,+BAA2B,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG;AAC9D,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,CAAC,IAAG,eAAe,IAAI,AAAC,CAAC,GAAE,CAAC,CAAG;AAC/B,aAAO,KAAG,CAAC;MACf;AAAA,AACA,WAAO,CAAA,IAAG,eAAe,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;IACvC,CAAC;AACD,+BAA2B,UAAU,kCAAkC,EAAI,UAAU,GAAE,CAAG;AACtF,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,IAAG,aAAa,CAAG;AACnB,aAAO,CAAA,GAAE,UAAU,AAAC,EAAC,CAAC;MAC1B,KACK;AACD,aAAO,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;MACtC;AAAA,IACJ,CAAC;AACD,+BAA2B,UAAU,2BAA2B,EAAI,UAAU,IAAG,CAAG;AAChF,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,IAAG,GAAK,KAAG,CAAG;AACd,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,IAAG,aAAa,CAAG;AACnB,aAAO;AACH,kBAAQ,CAAG,CAAA,IAAG,QAAQ,UAAU,AAAC,EAAC;AAClC,uBAAa,CAAG,CAAA,YAAW,YAAY,IAAI,AAAC,CAAC,IAAG,aAAa,CAAG,UAAU,GAAE,CAAG;AAAE,iBAAO,CAAA,GAAE,UAAU,AAAC,EAAC,CAAC;UAAE,CAAC;AAAA,QAC9G,CAAC;MACL,KACK;AACD,aAAO;AACH,kBAAQ,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAC;AAC9C,uBAAa,CAAG,CAAA,YAAW,YAAY,IAAI,AAAC,CAAC,IAAG,aAAa,CAAG,UAAU,GAAE,CAAG;AAAE,iBAAO,CAAA,KAAI,cAAc,IAAI,AAAC,CAAC,GAAE,CAAC,CAAC;UAAE,CAAC;AAAA,QAC3H,CAAC;MACL;AAAA,IACJ,CAAC;AACD,+BAA2B,UAAU,6BAA6B,EAAI,UAAU,GAAE,CAAG;AACjF,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,GAAE,GAAK,KAAG,CAAG;AACb,aAAO,KAAG,CAAC;MACf;AAAA,AACI,QAAA,CAAA,OAAM,EAAI,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAE,SAAQ,CAAC,CAAC,CAAC;AAC3D,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,YAAW,YAAY,IAAI,AAAC,CAAC,GAAE,CAAE,cAAa,CAAC,CAAG,UAAU,GAAE,CAAG;AAAE,aAAO,CAAA,KAAI,6BAA6B,AAAC,CAAC,GAAE,CAAC,CAAC;MAAE,CAAC,CAAC;AACrI,WAAO,IAAI,CAAA,KAAI,wBAAwB,AAAC,CAAC,OAAM,CAAG,UAAQ,CAAC,CAAC;IAChE,CAAC;AACD,+BAA2B,EAAI,CAAA,UAAS,AAAC,CAAC,CACtC,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,OAAM,AAAC,CAAC,CAAA,CAAG,CAAA,IAAG,OAAO,AAAC,CAAC,KAAI,cAAc,CAAC,CAAC,CAC3C,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,MAAK,CAAC,CAAC,CAC5C,CAAG,6BAA2B,CAAC,CAAC;AAChC,SAAO,6BAA2B,CAAC;EACvC,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,6BAA6B,EAAI,6BAA2B,CAAC;AACnE,AAAI,IAAA,CAAA,sBAAqB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAC5C,YAAQ,AAAC,CAAC,sBAAqB,CAAG,OAAK,CAAC,CAAC;AACzC,WAAS,uBAAqB,CAAE,SAAQ,CAAG;AACvC,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,UAAQ,CAAC;IAC9B;AAAA,AACA,yBAAqB,UAAU,UAAU,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,CAAC;IAAE,CAAC;AACnF,yBAAqB,YAAY,EAAI,UAAU,GAAE,CAAG;AAChD,WAAO,IAAI,uBAAqB,AAAC,CAAC,GAAE,CAAC,CAAC;IAC1C,CAAC;AACD,SAAO,uBAAqB,CAAC;EACjC,CAAC,AAAC,CAAC,KAAI,cAAc,CAAC,CAAC;AACvB,QAAM,uBAAuB,EAAI,uBAAqB,CAAC;AACvD,AAAI,IAAA,CAAA,0BAAyB,EAAI,CAAA,CAAC,SAAU,MAAK,CAAG;AAChD,YAAQ,AAAC,CAAC,0BAAyB,CAAG,OAAK,CAAC,CAAC;AAC7C,WAAS,2BAAyB,CAAE,SAAQ,CAAG;AAC3C,WAAK,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;AACjB,SAAG,UAAU,EAAI,UAAQ,CAAC;IAC9B;AAAA,AACA,6BAAyB,UAAU,UAAU,EAAI,UAAS,AAAC,CAAE;AAAE,WAAO,CAAA,IAAG,UAAU,CAAC;IAAE,CAAC;AACvF,6BAAyB,YAAY,EAAI,UAAU,GAAE,CAAG;AACpD,WAAO,IAAI,2BAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;IAC9C,CAAC;AACD,SAAO,2BAAyB,CAAC;EACrC,CAAC,AAAC,CAAC,KAAI,kBAAkB,CAAC,CAAC;AAC3B,QAAM,2BAA2B,EAAI,2BAAyB,CAAC;AArK/D,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAqKwC;ACtK3D,KAAK,SAAS,AAAC,CAAC,kCAAiC,CAAG,EAAC,+BAA8B,CAAE,sCAAoC,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAzM,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AAAzB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,UAAS,CAAC;AACd,AAAI,IAAA,CAAA,WAAU,EAAI,GAAC,CAAC;AACpB,AAAI,IAAA,CAAA,sBAAqB,EAAI,GAAC,CAAC;AAC/B,AAAI,IAAA,CAAA,cAAa,EAAI,GAAC,CAAC;AAWvB,SAAS,UAAQ,CAAE,EAAC,CAAG;AACnB,OAAI,MAAK,OAAO,KAAK,iBAAiB,CAAG;AACrC,UAAM,IAAI,MAAI,AAAC,CAAC,qCAAoC,CAAC,CAAC;IAC1D;AAAA,AACI,MAAA,CAAA,aAAY,EAAI,CAAA,MAAK,OAAO,KAAK,KAAK,AAAC,CAAC;AACxC,eAAS,CAAG,YAAU;AACtB,iBAAW,CAAG,cAAY;AAC1B,gBAAU,CAAG,aAAW;AACxB,kBAAY,CAAG,eAAa;AAC5B,sBAAgB,CAAG,mBAAiB;AACpC,qBAAe,CAAG,KAAG;AAAA,IACzB,CAAC,CAAC;AACF,SAAO,UAAS,AAAC,CAAE;AACf,AAAI,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,UAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,WAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;MAChC;AAAA,AAEA,eAAS,EAAI,IAAI,CAAA,OAAM,yBAAyB,AAAC,EAAC,CAAC;AACnD,uBAAiB,AAAC,EAAC,CAAC;AACpB,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,aAAY,IAAI,AAAC,CAAC,SAAS,AAAC,CAAE;AACpC,AAAI,UAAA,CAAA,GAAE,EAAI,CAAA,EAAC,MAAM,AAAC,CAAC,IAAK,EAAA,CAAG,KAAG,CAAC,CAAC;AAChC,sBAAc,AAAC,EAAC,CAAC;AACjB,aAAO,IAAE,CAAC;MACd,CAAC,CAAC;AACF,SAAI,sBAAqB,OAAO,EAAI,EAAA,CAAG;AACnC,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,sBAAqB,OAAO,EAAI,yCAAuC,CAAC,CAAC;MAClH;AAAA,AACA,SAAI,cAAa,OAAO,EAAI,EAAA,CAAG;AAC3B,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,cAAa,OAAO,EAAI,gCAA8B,CAAC,CAAC;MACjG;AAAA,AACA,eAAS,EAAI,KAAG,CAAC;AACjB,iBAAW,YAAY,MAAM,AAAC,CAAC,WAAU,CAAC,CAAC;AAC3C,WAAO,IAAE,CAAC;IACd,CAAC;EACL;AAAA,AACA,QAAM,UAAU,EAAI,UAAQ,CAAC;AAE7B,SAAS,mBAAiB,CAAC,AAAC,CAAE;AAC1B,eAAW,YAAY,MAAM,AAAC,CAAC,WAAU,CAAC,CAAC;AAC3C,eAAW,YAAY,MAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AACtD,eAAW,YAAY,MAAM,AAAC,CAAC,cAAa,CAAC,CAAC;EAClD;AAAA,AACA,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAS/C,SAAS,KAAG,CAAE,MAAK,CAAG;AAClB,OAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,WAAK,EAAI,EAAA,CAAC;IAAE;AAAA,AACrC,yBAAqB,AAAC,EAAC,CAAC;AACxB,kBAAc,AAAC,EAAC,CAAC;AACjB,aAAS,KAAK,AAAC,CAAC,MAAK,CAAC,CAAC;EAC3B;AAAA,AACA,QAAM,KAAK,EAAI,KAAG,CAAC;AAInB,SAAS,gBAAc,CAAC,AAAC,CAAE;AACvB,yBAAqB,AAAC,EAAC,CAAC;AACxB,UAAO,WAAU,OAAO,EAAI,EAAA,CAAG;AAC3B,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,YAAW,YAAY,SAAS,AAAC,CAAC,WAAU,CAAG,EAAA,CAAC,CAAC;AACjE,cAAQ,AAAC,EAAC,CAAC;IACf;AAAA,EACJ;AAAA,AACA,QAAM,gBAAgB,EAAI,gBAAc,CAAC;AACzC,SAAS,YAAU,CAAE,EAAC,CAAG,CAAA,KAAI,CAAG;AAC5B,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACI,MAAA,CAAA,EAAC,EAAI,CAAA,WAAU,AAAC,CAAC,EAAC,CAAC,CAAC;AACxB,AAAI,MAAA,CAAA,EAAC,EAAI,CAAA,UAAS,iBAAiB,AAAC,CAAC,EAAC,CAAG,MAAI,CAAG,KAAG,CAAC,CAAC;AACrD,iBAAa,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;AACvB,aAAS,iBAAiB,AAAC,CAAC,aAAY,AAAC,CAAC,EAAC,CAAC,CAAG,MAAI,CAAC,CAAC;AACrD,SAAO,GAAC,CAAC;EACb;AAAA,AACA,SAAS,cAAY,CAAE,EAAC,CAAG;AACvB,gBAAY,AAAC,CAAC,EAAC,CAAC,CAAC;AACjB,SAAO,CAAA,UAAS,qBAAqB,AAAC,CAAC,EAAC,CAAC,CAAC;EAC9C;AAAA,AACA,SAAS,aAAW,CAAE,EAAC,CAAG,CAAA,QAAO,CAAG;AAChC,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACI,MAAA,CAAA,EAAC,EAAI,CAAA,WAAU,AAAC,CAAC,EAAC,CAAC,CAAC;AACxB,AAAI,MAAA,CAAA,EAAC,EAAI,CAAA,UAAS,iBAAiB,AAAC,CAAC,EAAC,CAAG,SAAO,CAAG,KAAG,CAAG,KAAG,CAAC,CAAC;AAC9D,yBAAqB,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;AAC/B,SAAO,GAAC,CAAC;EACb;AAAA,AACA,SAAS,eAAa,CAAE,EAAC,CAAG;AACxB,eAAW,YAAY,OAAO,AAAC,CAAC,sBAAqB,CAAG,GAAC,CAAC,CAAC;AAC3D,SAAO,CAAA,UAAS,qBAAqB,AAAC,CAAC,EAAC,CAAC,CAAC;EAC9C;AAAA,AACA,SAAS,YAAU,CAAE,EAAC,CAAG;AACrB,SAAO,UAAS,AAAC,CAAE;AACf,AAAI,QAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,UAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,WAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;MAChC;AAAA,AACA,OAAC,MAAM,AAAC,CAAC,MAAK,OAAO,CAAG,KAAG,CAAC,CAAC;AAC7B,oBAAc,AAAC,EAAC,CAAC;IACrB,CAAC;EACL;AAAA,AACA,SAAS,mBAAiB,CAAE,SAAQ,CAAG;AACnC,cAAU,KAAK,AAAC,CAAC,SAAQ,CAAC,CAAC;EAC/B;AAAA,AACA,SAAS,cAAY,CAAE,EAAC,CAAG;AACvB,SAAO,UAAS,AAAC,CAAE;AAAE,iBAAW,YAAY,OAAO,AAAC,CAAC,cAAa,CAAG,GAAC,CAAC,CAAC;IAAE,CAAC;EAC/E;AAAA,AACA,SAAS,uBAAqB,CAAC,AAAC,CAAE;AAC9B,OAAI,CAAC,MAAK,OAAO,KAAK,CAAA,EAAK,EAAC,MAAK,OAAO,KAAK,iBAAiB,CAAG;AAC7D,UAAM,IAAI,MAAI,AAAC,CAAC,wEAAuE,CAAC,CAAC;IAC7F;AAAA,EACJ;AAzIA,AAyIA,OAzIK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAyIkB;AC1IrC,KAAK,SAAS,AAAC,CAAC,4CAA2C,CAAG,EAAC,+BAA8B,CAAE,sCAAoC,CAAE,sCAAoC,CAAE,+BAA6B,CAAE,sCAAoC,CAAE,sDAAoD,CAAE,mDAAiD,CAAE,uBAAqB,CAAE,8DAA4D,CAAE,mEAAiE,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAzhB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAC1D,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,OAAM,AAAC,CAAC,qDAAoD,CAAC,CAAC;AACvF,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,kDAAiD,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,6BAA4B,EAAI,CAAA,OAAM,AAAC,CAAC,6DAA4D,CAAC,CAAC;AAC1G,AAAI,IAAA,CAAA,kCAAiC,EAAI,CAAA,OAAM,AAAC,CAAC,kEAAiE,CAAC,CAAC;AAGpH,QAAM,UAAU,EAAI,OAAK,CAAC;AAC1B,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAC1B,WAAS,WAAS,CAAE,OAAM,CAAG,CAAA,eAAc,CAAG,CAAA,gBAAe,CAAG;AAC5D,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,gBAAgB,EAAI,gBAAc,CAAC;AACtC,SAAG,iBAAiB,EAAI,iBAAe,CAAC;AACxC,SAAG,cAAc,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAC3C,AAAI,QAAA,CAAA,WAAU,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACxC,gBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,SAAS,KAAK,CAAC;AACpC,gBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,SAAS,UAAU,CAAC;AACzC,gBAAU,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,SAAS,SAAS,CAAC;AACxC,SAAG,cAAc,IAAI,AAAC,CAAC,KAAI,SAAS,CAAG,YAAU,CAAC,CAAC;AACnD,AAAI,QAAA,CAAA,oBAAmB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACjD,yBAAmB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,kBAAkB,SAAS,CAAC;AAC1D,yBAAmB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,kBAAkB,OAAO,CAAC;AACxD,yBAAmB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,kBAAkB,KAAK,CAAC;AACtD,SAAG,cAAc,IAAI,AAAC,CAAC,KAAI,kBAAkB,CAAG,qBAAmB,CAAC,CAAC;AACrE,AAAI,QAAA,CAAA,sBAAqB,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AACnD,2BAAqB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,oBAAoB,SAAS,CAAC;AAC9D,2BAAqB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,oBAAoB,UAAU,CAAC;AAC/D,2BAAqB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,oBAAoB,MAAM,CAAC;AAC3D,2BAAqB,CAAE,CAAA,CAAC,EAAI,CAAA,KAAI,oBAAoB,MAAM,CAAC;AAC3D,SAAG,cAAc,IAAI,AAAC,CAAC,KAAI,oBAAoB,CAAG,uBAAqB,CAAC,CAAC;IAC7E;AAAA,AACA,aAAS,UAAU,UAAU,EAAI,UAAU,GAAE,CAAG,CAAA,IAAG,CAAG;AAClD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,CAAC,MAAK,UAAU,AAAC,CAAC,GAAE,CAAC,CAAG;AACxB,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,MAAK,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACrB,AAAI,UAAA,CAAA,aAAY,EAAI,GAAC,CAAC;AACtB,mBAAW,YAAY,QAAQ,AAAC,CAAC,GAAE,CAAG,UAAU,GAAE,CAAG;AAAE,sBAAY,KAAK,AAAC,CAAC,KAAI,UAAU,AAAC,CAAC,GAAE,CAAG,KAAG,CAAC,CAAC,CAAC;QAAE,CAAC,CAAC;AACzG,aAAO,cAAY,CAAC;MACxB;AAAA,AACA,SAAI,IAAG,GAAK,CAAA,OAAM,UAAU,CAAG;AAC3B,aAAO,IAAE,CAAC;MACd;AAAA,AACA,SAAI,IAAG,GAAK,CAAA,KAAI,eAAe,CAAG;AAC9B,aAAO,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC7C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,gBAAgB,CAAG;AACpC,aAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAC,CAAC;MAC9C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,aAAa,CAAG;AACjC,aAAO,CAAA,IAAG,uBAAuB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC3C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,oBAAoB,CAAG;AACxC,aAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC5C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,wBAAwB,CAAG;AAC5C,aAAO,CAAA,IAAG,4BAA4B,AAAC,CAAC,GAAE,CAAC,CAAC;MAChD,KACK,KAAI,IAAG,GAAK,CAAA,kBAAiB,cAAc,CAAG;AAC/C,aAAO,CAAA,IAAG,wBAAwB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC5C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,mBAAmB,CAAG;AACvC,aAAO,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,GAAE,CAAC,CAAC;MAC9C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,4BAA4B,CAAG;AAChD,aAAO,CAAA,IAAG,sCAAsC,AAAC,CAAC,GAAE,CAAC,CAAC;MAC1D,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,cAAc,CAAG;AAClC,aAAO,CAAA,IAAG,iBAAiB,uBAAuB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC5D,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,kBAAkB,CAAG;AACtC,aAAO,CAAA,IAAG,iBAAiB,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;MAChE,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,oBAAoB,CAAG;AACxC,aAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;MAC/C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,uBAAuB,CAAG;AAC3C,aAAO,CAAA,IAAG,iCAAiC,AAAC,CAAC,GAAE,CAAC,CAAC;MACrD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,aAAa,CAAG;AACjC,aAAO,CAAA,IAAG,uBAAuB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC3C,KACK;AACD,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,oBAAmB,EAAI,CAAA,IAAG,SAAS,AAAC,EAAC,CAAC,CAAC;MAChF;AAAA,IACJ,CAAC;AACD,aAAS,UAAU,YAAY,EAAI,UAAU,GAAE,CAAG,CAAA,IAAG,CAAG,CAAA,IAAG,CAAG;AAC1D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,CAAC,MAAK,UAAU,AAAC,CAAC,GAAE,CAAC,CAAG;AACxB,aAAO,KAAG,CAAC;MACf;AAAA,AACA,SAAI,MAAK,QAAQ,AAAC,CAAC,GAAE,CAAC,CAAG;AACrB,AAAI,UAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,mBAAW,YAAY,QAAQ,AAAC,CAAC,GAAE,CAAG,UAAU,GAAE,CAAG;AAAE,YAAE,KAAK,AAAC,CAAC,KAAI,YAAY,AAAC,CAAC,GAAE,CAAG,KAAG,CAAG,KAAG,CAAC,CAAC,CAAC;QAAE,CAAC,CAAC;AACvG,aAAO,IAAE,CAAC;MACd;AAAA,AACA,SAAI,IAAG,GAAK,CAAA,OAAM,UAAU,CAAG;AAC3B,aAAO,IAAE,CAAC;MACd;AAAA,AACA,SAAI,IAAG,GAAK,CAAA,KAAI,eAAe,CAAG;AAC9B,aAAO,CAAA,IAAG,2BAA2B,AAAC,CAAC,GAAE,CAAC,CAAC;MAC/C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,gBAAgB,CAAG;AACpC,aAAO,CAAA,IAAG,4BAA4B,AAAC,CAAC,GAAE,CAAC,CAAC;MAChD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,aAAa,CAAG;AACjC,aAAO,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC7C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,wBAAwB,CAAG;AAC5C,aAAO,CAAA,IAAG,8BAA8B,AAAC,CAAC,GAAE,CAAC,CAAC;MAClD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,oBAAoB,CAAG;AACxC,aAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAC,CAAC;MAC9C,KACK,KAAI,IAAG,GAAK,CAAA,kBAAiB,cAAc,CAAG;AAC/C,aAAO,CAAA,IAAG,0BAA0B,AAAC,CAAC,GAAE,CAAG,KAAG,CAAC,CAAC;MACpD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,mBAAmB,CAAG;AACvC,aAAO,CAAA,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAC,CAAC;MAChD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,4BAA4B,CAAG;AAChD,aAAO,CAAA,IAAG,wCAAwC,AAAC,CAAC,GAAE,CAAC,CAAC;MAC5D,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,cAAc,CAAG;AAClC,aAAO,CAAA,IAAG,iBAAiB,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC9D,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,kBAAkB,CAAG;AACtC,aAAO,CAAA,IAAG,iBAAiB,6BAA6B,AAAC,CAAC,GAAE,CAAC,CAAC;MAClE,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,oBAAoB,CAAG;AACxC,aAAO,CAAA,IAAG,6BAA6B,AAAC,CAAC,GAAE,CAAC,CAAC;MACjD,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,aAAa,CAAG;AACjC,aAAO,CAAA,IAAG,yBAAyB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC7C,KACK,KAAI,IAAG,GAAK,CAAA,KAAI,uBAAuB,CAAG;AAC3C,aAAO,CAAA,IAAG,mCAAmC,AAAC,CAAC,GAAE,CAAC,CAAC;MACvD,KACK;AACD,YAAM,IAAI,CAAA,YAAW,cAAc,AAAC,CAAC,sBAAqB,EAAI,CAAA,IAAG,SAAS,AAAC,EAAC,CAAC,CAAC;MAClF;AAAA,IACJ,CAAC;AACD,aAAS,UAAU,YAAY,EAAI,UAAU,GAAE,CAAG,CAAA,IAAG,CAAG;AACpD,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,AAAI,QAAA,CAAA,MAAK,EAAI,GAAC,CAAC;AACf,AAAI,QAAA,CAAA,SAAQ,EAAI,CAAA,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC,CAAC;AACtC,iBAAW,WAAW,QAAQ,AAAC,CAAC,GAAE,CAAG,UAAU,KAAI,CAAG,CAAA,GAAE,CAAG;AACvD,WAAI,SAAQ,CAAG;AACX,eAAK,CAAE,GAAE,CAAC,EAAI,CAAA,KAAI,UAAU,AAAC,CAAC,KAAI,CAAG,KAAG,CAAC,CAAC;QAC9C,KACK;AACD,eAAK,CAAE,GAAE,CAAC,EAAI,MAAI,CAAC;QACvB;AAAA,MACJ,CAAC,CAAC;AACF,WAAO,OAAK,CAAC;IACjB,CAAC;AAMD,aAAS,UAAU,YAAY,EAAI,UAAU,GAAE,CAAG,CAAA,IAAG,CAAG,CAAA,IAAG,CAAG;AAC1D,AAAI,QAAA,CAAA,KAAI,EAAI,KAAG,CAAC;AAChB,SAAI,MAAK,UAAU,AAAC,CAAC,IAAG,CAAC,CAAG;AACxB,AAAI,UAAA,CAAA,GAAE,EAAI,IAAI,CAAA,YAAW,IAAI,AAAC,EAAC,CAAC;AAChC,mBAAW,iBAAiB,QAAQ,AAAC,CAAC,GAAE,CAAG,UAAU,GAAE,CAAG,CAAA,GAAE,CAAG;AAAE,YAAE,IAAI,AAAC,CAAC,GAAE,CAAG,CAAA,KAAI,YAAY,AAAC,CAAC,GAAE,CAAG,KAAG,CAAG,KAAG,CAAC,CAAC,CAAC;QAAE,CAAC,CAAC;AACrH,aAAO,IAAE,CAAC;MACd,KACK;AACD,aAAO,CAAA,YAAW,WAAW,oBAAoB,AAAC,CAAC,GAAE,CAAC,CAAC;MAC3D;AAAA,IACJ,CAAC;AACD,aAAS,UAAU,oBAAoB,EAAI,UAAU,aAAY,CAAG;AAAE,SAAG,iBAAiB,SAAS,AAAC,CAAC,aAAY,CAAC,CAAC;IAAE,CAAC;AACtH,aAAS,UAAU,iCAAiC,EAAI,UAAU,OAAM,CAAG;AACvE,WAAO;AACH,aAAK,CAAG,CAAA,MAAK,cAAc,AAAC,CAAC,OAAM,KAAK,CAAC;AACzC,sBAAc,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,OAAM,cAAc,CAAG,CAAA,kBAAiB,cAAc,CAAC;AACvF,iBAAS,CAAG,CAAA,OAAM,SAAS;AAC3B,aAAK,CAAG,CAAA,OAAM,KAAK;AAAA,MACvB,CAAC;IACL,CAAC;AACD,aAAS,UAAU,mCAAmC,EAAI,UAAU,GAAE,CAAG;AACrE,AAAI,QAAA,CAAA,IAAG,EAAI,CAAA,MAAK,gBAAgB,AAAC,CAAC,GAAE,CAAE,MAAK,CAAC,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,KAAI,oBAAoB,CAAC,CAAC,CAAC;AACjG,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,kBAAiB,cAAc,CAAG,UAAQ,CAAC,CAAC;AAC7F,WAAO,IAAI,CAAA,KAAI,uBAAuB,AAAC,CAAC,IAAG,CAAG,IAAE,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAG,CAAA,GAAE,CAAE,MAAK,CAAC,CAAC,CAAC;IACpF,CAAC;AACD,aAAS,UAAU,uBAAuB,EAAI,UAAU,OAAM,CAAG;AAC7D,WAAO;AAAE,iBAAS,CAAG,CAAA,OAAM,SAAS;AAAG,eAAO,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,OAAM,OAAO,CAAG,CAAA,kBAAiB,cAAc,CAAC;AAAA,MAAE,CAAC;IACvH,CAAC;AACD,aAAS,UAAU,yBAAyB,EAAI,UAAU,GAAE,CAAG;AAC3D,WAAO,IAAI,CAAA,KAAI,aAAa,AAAC,CAAC,GAAE,CAAE,UAAS,CAAC,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,QAAO,CAAC,CAAG,CAAA,kBAAiB,cAAc,CAAG,SAAO,CAAC,CAAC,CAAC;IAC/H,CAAC;AACD,aAAS,UAAU,2BAA2B,EAAI,UAAU,UAAS,CAAG;AACpE,WAAO;AACH,mBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,UAAS,WAAW,CAAG,CAAA,KAAI,cAAc,CAAC;AACvE,gCAAwB,CAAG,CAAA,UAAS,wBAAwB;AAAA,MAChE,CAAC;IACL,CAAC;AACD,aAAS,UAAU,6BAA6B,EAAI,UAAU,GAAE,CAAG;AAC/D,WAAO,IAAI,CAAA,KAAI,oBAAoB,AAAC,CAAC,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,CAAA,KAAI,cAAc,CAAC,CAAG,CAAA,GAAE,CAAE,yBAAwB,CAAC,CAAC,CAAC;IAClI,CAAC;AACD,aAAS,UAAU,sCAAsC,EAAI,UAAU,OAAM,CAAG;AAC5E,WAAO;AACH,2BAAmB,CAAG,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,OAAM,mBAAmB,CAAC;AAC/E,sBAAc,CAAG,CAAA,OAAM,cAAc;AACrC,6BAAqB,CAAG,CAAA,OAAM,qBAAqB;AACnD,2BAAmB,CAAG,CAAA,OAAM,mBAAmB;AAC/C,0BAAkB,CAAG,CAAA,OAAM,kBAAkB;AAC7C,sCAA8B,CAAG,CAAA,OAAM,8BAA8B;AACrE,mCAA2B,CAAG,CAAA,OAAM,2BAA2B;AAAA,MACnE,CAAC;IACL,CAAC;AACD,aAAS,UAAU,wCAAwC,EAAI,UAAU,GAAE,CAAG;AAC1E,WAAO,IAAI,CAAA,KAAI,4BAA4B,AAAC,CAAC,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAE,oBAAmB,CAAC,CAAC,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,GAAE,CAAE,sBAAqB,CAAC,CAAG,CAAA,GAAE,CAAE,oBAAmB,CAAC,CAAG,CAAA,GAAE,CAAE,mBAAkB,CAAC,CAAG,CAAA,GAAE,CAAE,+BAA8B,CAAC,CAAG,CAAA,GAAE,CAAE,4BAA2B,CAAC,CAAC,CAAC;IAC9R,CAAC;AACD,aAAS,UAAU,wBAAwB,EAAI,UAAU,IAAG,CAAG;AAC3D,WAAO;AAAE,cAAM,CAAG,CAAA,IAAG,OAAO;AAAG,iBAAS,CAAG,CAAA,IAAG,SAAS;AAAA,MAAE,CAAC;IAC9D,CAAC;AACD,aAAS,UAAU,0BAA0B,EAAI,UAAU,GAAE,CAAG,CAAA,IAAG,CAAG;AAElE,AAAI,QAAA,CAAA,GAAE,CAAC;AACP,aAAQ,IAAG;AACP,WAAK,SAAO;AACR,YAAE,EAAI,CAAA,IAAG,QAAQ,YAAY,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AAC7D,eAAK;AAAA,AACT,WAAK,UAAQ;AACT,YAAE,EAAI,CAAA,IAAG,QAAQ,aAAa,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AAC9D,eAAK;AAAA,AACT,WAAK,gBAAc;AACf,YAAE,EAAI,CAAA,IAAG,QAAQ,mBAAmB,AAAC,CAAC,GAAE,CAAE,OAAM,CAAC,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC,CAAC,CAAC;AACpE,eAAK;AAAA,AACT;AACI,cAAM,CAAA,0BAAyB,EAAI,KAAG,CAAC;AADpC,MAEX;AACA,WAAO,IAAE,CAAC;IACd,CAAC;AACD,aAAS,UAAU,yBAAyB,EAAI,UAAU,IAAG,CAAG;AAC5D,WAAO;AACH,oBAAY,CAAG,CAAA,IAAG,YAAY;AAC9B,uBAAe,CAAG,CAAA,IAAG,eAAe;AACpC,iBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,mBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,WAAW,CAAG,CAAA,KAAI,wBAAwB,CAAC;AAC3E,qBAAa,CAAG,CAAA,IAAG,aAAa;AAChC,eAAO,CAAG,CAAA,IAAG,OAAO;AACpB,sBAAc,CAAG,CAAA,MAAK,cAAc,AAAC,CAAC,IAAG,cAAc,CAAC;AAAA,MAC5D,CAAC;IACL,CAAC;AACD,aAAS,UAAU,2BAA2B,EAAI,UAAU,GAAE,CAAG;AAC7D,WAAO,IAAI,CAAA,KAAI,eAAe,AAAC,CAAC;AAC5B,kBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,qBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AAAG,eAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AAC/D,iBAAS,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,CAAA,KAAI,wBAAwB,CAAC;AAC7E,mBAAW,CAAG,CAAA,GAAE,CAAE,cAAa,CAAC;AAChC,aAAK,CAAG,CAAA,GAAE,CAAE,QAAO,CAAC;AACpB,oBAAY,CAAG,CAAA,MAAK,gBAAgB,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,KAAI,kBAAkB,CAAC,CAAC;AAAA,MAC/G,CAAC,CAAC;IACN,CAAC;AACD,aAAS,UAAU,0BAA0B,EAAI,UAAU,MAAK,CAAG;AAC/D,WAAO;AACH,uBAAe,CAAG,CAAA,MAAK,eAAe;AACtC,yBAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,iBAAiB,CAAG,CAAA,kBAAiB,cAAc,CAAC;AAC9F,sBAAc,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,cAAc,CAAG,CAAA,KAAI,aAAa,CAAC;AACxE,6BAAqB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,qBAAqB,CAAG,CAAA,KAAI,uBAAuB,CAAC;AAAA,MACpG,CAAC;IACL,CAAC;AACD,aAAS,UAAU,4BAA4B,EAAI,UAAU,GAAE,CAAG;AAC9D,WAAO,IAAI,CAAA,KAAI,gBAAgB,AAAC,CAAC;AAC7B,qBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AACpC,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAG,CAAA,kBAAiB,cAAc,CAAG,UAAQ,CAAC;AACvG,oBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,KAAI,aAAa,CAAC;AACxE,2BAAmB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,sBAAqB,CAAC,CAAG,CAAA,KAAI,uBAAuB,CAAC;AAAA,MACpG,CAAC,CAAC;IACN,CAAC;AACD,aAAS,UAAU,wBAAwB,EAAI,UAAU,MAAK,CAAG;AAC7D,WAAO;AACH,cAAM,CAAG,CAAA,MAAK,MAAM;AACpB,oBAAY,CAAG,CAAA,MAAK,YAAY;AAChC,yBAAiB,CAAG,CAAA,MAAK,iBAAiB;AAC1C,mBAAW,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,WAAW,CAAG,CAAA,KAAI,gBAAgB,CAAC;AACrE,wBAAgB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,gBAAgB,CAAG,CAAA,KAAI,aAAa,CAAC;AAC5E,yBAAiB,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,iBAAiB,CAAG,CAAA,KAAI,uBAAuB,CAAC;AACxF,yBAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,iBAAiB,CAAC;AAC5D,sBAAc,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,MAAK,cAAc,CAAG,CAAA,KAAI,aAAa,CAAC;AACxE,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,MAAK,eAAe,CAAC;AAAA,MAC5D,CAAC;IACL,CAAC;AACD,aAAS,UAAU,0BAA0B,EAAI,UAAU,GAAE,CAAG;AAC5D,WAAO,IAAI,CAAA,KAAI,oBAAoB,AAAC,CAAC;AACjC,YAAI,CAAG,CAAA,GAAE,CAAE,OAAM,CAAC;AAClB,kBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,uBAAe,CAAG,CAAA,GAAE,CAAE,kBAAiB,CAAC;AACxC,iBAAS,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,YAAW,CAAC,CAAG,CAAA,KAAI,gBAAgB,CAAC;AACrE,sBAAc,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,iBAAgB,CAAC,CAAG,CAAA,KAAI,aAAa,CAAC;AAC5E,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAG,CAAA,KAAI,uBAAuB,CAAC;AACxF,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAC;AAC1D,oBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAG,CAAA,KAAI,aAAa,CAAC;AACxE,qBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AAAA,MAC1D,CAAC,CAAC;IACN,CAAC;AACD,aAAS,UAAU,uBAAuB,EAAI,UAAU,IAAG,CAAG;AAC1D,WAAO;AACH,eAAO,CAAG,CAAA,IAAG,gBAAgB,UAAU,AAAC,CAAC,IAAG,OAAO,CAAC;AACpD,uBAAe,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,eAAe,CAAG,CAAA,KAAI,oBAAoB,CAAC;AAC/E,yBAAiB,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,iBAAiB,CAAC;AAC1D,aAAK,CAAG,CAAA,MAAK,cAAc,AAAC,CAAC,IAAG,KAAK,CAAC;AACtC,qBAAa,CAAG,CAAA,IAAG,UAAU,AAAC,CAAC,IAAG,aAAa,CAAG,CAAA,kBAAiB,cAAc,CAAC;AAClF,iCAAyB,CAAG,CAAA,IAAG,yBAAyB;AAAA,MAC5D,CAAC;IACL,CAAC;AACD,aAAS,UAAU,yBAAyB,EAAI,UAAU,GAAE,CAAG;AAC3D,WAAO,IAAI,CAAA,KAAI,aAAa,AAAC,CAAC;AAC1B,aAAK,CAAG,CAAA,IAAG,gBAAgB,YAAY,AAAC,CAAC,GAAE,CAAE,QAAO,CAAC,CAAC;AACtD,qBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAG,CAAA,KAAI,oBAAoB,CAAC;AACjF,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,kBAAiB,CAAC,CAAC;AAC1D,mBAAW,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,cAAa,CAAC,CAAG,CAAA,kBAAiB,cAAc,CAAG,gBAAc,CAAC;AACrG,WAAG,CAAG,CAAA,MAAK,gBAAgB,AAAC,CAAC,GAAE,CAAE,MAAK,CAAC,CAAG,CAAA,IAAG,cAAc,IAAI,AAAC,CAAC,KAAI,SAAS,CAAC,CAAC;AAChF,+BAAuB,CAAG,CAAA,GAAE,CAAE,0BAAyB,CAAC;AAAA,MAC5D,CAAC,CAAC;IACN,CAAC;AACD,aAAS,UAAU,4BAA4B,EAAI,UAAU,IAAG,CAAG;AAC/D,AAAI,QAAA,CAAA,GAAE,EAAI;AACN,WAAG,CAAG,CAAA,IAAG,GAAG;AACZ,iBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,wBAAgB,CAAG,CAAA,IAAG,gBAAgB;AACtC,eAAO,CAAG,CAAA,IAAG,OAAO;AACpB,mBAAW,CAAG,CAAA,IAAG,WAAW;AAC5B,uBAAe,CAAG,CAAA,IAAG,eAAe;AACpC,aAAK,CAAG,CAAA,IAAG,KAAK;AAChB,sBAAc,CAAG,CAAA,IAAG,cAAc;AAClC,sBAAc,CAAG,CAAA,IAAG,cAAc;AAClC,oBAAY,CAAG,CAAA,IAAG,YAAY;AAC9B,mBAAW,CAAG,CAAA,IAAG,WAAW;AAC5B,gCAAwB,CAAG,CAAA,IAAG,wBAAwB;AACtD,wBAAgB,CAAG,CAAA,IAAG,gBAAgB;AACtC,iBAAS,CAAG,CAAA,IAAG,SAAS;AACxB,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,eAAe,CAAC;AACtD,sBAAc,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,cAAc,CAAC;AACpD,uBAAe,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,IAAG,eAAe,CAAC;AAAA,MAC1D,CAAC;AACD,WAAO,IAAE,CAAC;IACd,CAAC;AACD,aAAS,UAAU,8BAA8B,EAAI,UAAU,GAAE,CAAG;AAChE,WAAO,IAAI,CAAA,KAAI,wBAAwB,AAAC,CAAC;AACrC,SAAC,CAAG,CAAA,GAAE,CAAE,IAAG,CAAC;AACZ,eAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AACxB,sBAAc,CAAG,CAAA,GAAE,CAAE,iBAAgB,CAAC;AACtC,qBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AACtD,oBAAY,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,eAAc,CAAC,CAAC;AACpD,qBAAa,CAAG,CAAA,IAAG,YAAY,AAAC,CAAC,GAAE,CAAE,gBAAe,CAAC,CAAC;AACtD,iBAAS,CAAG,CAAA,GAAE,CAAE,YAAW,CAAC;AAC5B,qBAAa,CAAG,CAAA,GAAE,CAAE,gBAAe,CAAC;AACpC,WAAG,CAAG,CAAA,GAAE,CAAE,MAAK,CAAC;AAChB,eAAO,CAAG,CAAA,GAAE,CAAE,UAAS,CAAC;AACxB,oBAAY,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC;AAClC,oBAAY,CAAG,CAAA,GAAE,CAAE,eAAc,CAAC;AAClC,kBAAU,CAAG,CAAA,GAAE,CAAE,aAAY,CAAC;AAC9B,iBAAS,CAAG,CAAA,GAAE,CAAE,YAAW,CAAC;AAC5B,8BAAsB,CAAG,CAAA,GAAE,CAAE,yBAAwB,CAAC;AACtD,sBAAc,CAAG,CAAA,GAAE,CAAE,iBAAgB,CAAC;AACtC,aAAK,CAAG,CAAA,GAAE,CAAE,QAAO,CAAC;AAAA,MACxB,CAAC,CAAC;IACN,CAAC;AACD,aAAS,EAAI,CAAA,UAAS,AAAC,CAAC,CACpB,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,QAAO,OAAO,CAAG,CAAA,6BAA4B,wBAAwB,CAAG,CAAA,kCAAiC,6BAA6B,CAAC,CAAC,CAC7K,CAAG,WAAS,CAAC,CAAC;AACd,SAAO,WAAS,CAAC;EACrB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,WAAW,EAAI,WAAS,CAAC;AAjY/B,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAiYkB;AClYrC,KAAK,SAAS,AAAC,CAAC,8CAA6C,CAAG,EAAC,sBAAqB,CAAE,gCAA8B,CAAE,sCAAoC,CAAE,gDAA8C,CAAE,2CAAyC,CAAE,sCAAoC,CAAE,sDAAoD,CAAE,8BAA4B,CAAE,kCAAgC,CAAE,oCAAkC,CAAE,wCAAsC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAzgB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,UAAS,CAAG,CAAA,MAAK,CAAG,CAAA,GAAE,CAAG,CAAA,IAAG,CAAG;AACnF,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,UAAS,CAAG,OAAK,CAAG,IAAE,CAAG,KAAG,CAAC,CAAC;AAAA,AACjI,WAAQ,SAAQ,OAAO;AACnB,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,CAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,OAAK,CAAC,CAAC;AAAA,AAC1F,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAC,CAAC,CAAG,KAAK,EAAA,CAAC;QAAE,CAAG,KAAK,EAAA,CAAC,CAAC;AAAA,AACvG,SAAK,EAAA;AAAG,aAAO,CAAA,UAAS,YAAY,AAAC,CAAC,SAAS,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,eAAO,CAAA,CAAC,CAAA,GAAK,CAAA,CAAA,AAAC,CAAC,MAAK,CAAG,IAAE,CAAG,EAAA,CAAC,CAAC,GAAK,EAAA,CAAC;QAAE,CAAG,KAAG,CAAC,CAAC;AAAA,IACzG;EACJ,CAAC;AACD,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,CAAC,IAAG,GAAK,CAAA,IAAG,WAAW,CAAC,GAAK,UAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAC1D,OAAI,MAAO,QAAM,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,QAAM,SAAS,CAAA,GAAM,WAAS;AAAG,WAAO,CAAA,OAAM,SAAS,AAAC,CAAC,CAAA,CAAG,EAAA,CAAC,CAAC;AAAA,EAC5G,CAAC;AACD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA8C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AACzE,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAC/D,AAAI,IAAA,CAAA,0BAAyB,EAAI,CAAA,OAAM,AAAC,CAAC,qDAAoD,CAAC,CAAC;AAC/F,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,6BAAQ,CAAC,CAAC;AAChC,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAgC,CAAC,CAAC;AACzD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAsC,CAAC,CAAC;AACtE,AAAI,IAAA,CAAA,iBAAgB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAIjC,WAAS,kBAAgB,CAAE,YAAW,CAAG;AACrC,SAAG,aAAa,EAAI,IAAI,CAAA,eAAc,aAAa,AAAC,CAAC,UAAS,aAAa,AAAC,CAAC,YAAW,SAAS,CAAC,CAAG,EAAA,CAAC,CAAC;AACvG,SAAG,qBAAqB,EAAI,CAAA,UAAS,aAAa,AAAC,CAAC,YAAW,SAAS,CAAC,CAAC;AAC1E,SAAG,cAAc,EAAI,aAAW,CAAC;IACrC;AAAA,AACA,oBAAgB,UAAU,cAAc,EAAI,UAAS,AAAC,CAAE;AACpD,SAAG,qBAAqB,eAAe,cAAc,AAAC,EAAC,CAAC;AACxD,SAAG,qBAAqB,eAAe,eAAe,AAAC,EAAC,CAAC;IAC7D,CAAC;AACD,oBAAgB,UAAU,QAAQ,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,cAAc,QAAQ,AAAC,EAAC,CAAC;IAAE,CAAC;AACnF,SAAO,kBAAgB,CAAC;EAC5B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,kBAAkB,EAAI,kBAAgB,CAAC;AAC7C,AAAI,IAAA,CAAA,kBAAiB,EAAI,EAAA,CAAC;AAI1B,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACpC,WAAS,qBAAmB,CAAE,SAAQ,CAAG;AACrC,SAAG,UAAU,EAAI,UAAQ,CAAC;AAC1B,SAAG,mBAAmB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACnC,SAAG,oBAAoB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACpC,SAAG,mBAAmB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACnC,SAAG,uBAAuB,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;AACvC,SAAG,eAAe,EAAI,IAAI,IAAE,AAAC,EAAC,CAAC;IACnC;AAAA,AACA,uBAAmB,UAAU,OAAO,EAAI,UAAS,AAAC,CAAE;AAChD,AAAI,QAAA,CAAA,KAAI,EAAI,IAAI,qBAAmB,AAAC,CAAC,IAAG,UAAU,CAAC,CAAC;AACpD,UAAI,eAAe,EAAI,CAAA,YAAW,WAAW,MAAM,AAAC,CAAC,IAAG,eAAe,CAAC,CAAC;AACzE,UAAI,oBAAoB,EAAI,CAAA,YAAW,WAAW,MAAM,AAAC,CAAC,IAAG,oBAAoB,CAAC,CAAC;AACnF,UAAI,mBAAmB,EAAI,CAAA,YAAW,WAAW,MAAM,AAAC,CAAC,IAAG,mBAAmB,CAAC,CAAC;AACjF,WAAO,MAAI,CAAC;IAChB,CAAC;AAUD,uBAAmB,UAAU,iBAAiB,EAAI,UAAU,aAAY,CAAG,CAAA,QAAO,CAAG;AACjF,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,UAAI,mBAAmB,IAAI,AAAC,CAAC,aAAY,CAAG,SAAO,CAAC,CAAC;AACrD,WAAO,MAAI,CAAC;IAChB,CAAC;AASD,uBAAmB,UAAU,aAAa,EAAI,UAAU,aAAY,CAAG,CAAA,IAAG,CAAG;AACzE,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,UAAI,eAAe,IAAI,AAAC,CAAC,aAAY,CAAG,KAAG,CAAC,CAAC;AAC7C,WAAO,MAAI,CAAC;IAChB,CAAC;AAUD,uBAAmB,UAAU,kBAAkB,EAAI,UAAU,aAAY,CAAG,CAAA,IAAG,CAAG,CAAA,EAAC,CAAG;AAClF,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,AAAI,QAAA,CAAA,qBAAoB,EAAI,CAAA,KAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAC,CAAC;AACxE,SAAI,CAAC,MAAK,UAAU,AAAC,CAAC,qBAAoB,CAAC,CAAG;AAC1C,YAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAG,IAAI,IAAE,AAAC,EAAC,CAAC,CAAC;AACvD,4BAAoB,EAAI,CAAA,KAAI,oBAAoB,IAAI,AAAC,CAAC,aAAY,CAAC,CAAC;MACxE;AAAA,AACA,0BAAoB,IAAI,AAAC,CAAC,IAAG,CAAG,GAAC,CAAC,CAAC;AACnC,WAAO,MAAI,CAAC;IAChB,CAAC;AAeD,uBAAmB,UAAU,iBAAiB,EAAI,UAAU,IAAG,CAAG,CAAA,QAAO,CAAG;AACxE,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,UAAI,mBAAmB,IAAI,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;AAC5C,WAAO,MAAI,CAAC;IAChB,CAAC;AAeD,uBAAmB,UAAU,qBAAqB,EAAI,UAAU,IAAG,CAAG,CAAA,QAAO,CAAG;AAC5E,AAAI,QAAA,CAAA,KAAI,EAAI,CAAA,IAAG,OAAO,AAAC,EAAC,CAAC;AACzB,UAAI,uBAAuB,IAAI,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;AAChD,WAAO,MAAI,CAAC;IAChB,CAAC;AAMD,uBAAmB,UAAU,YAAY,EAAI,UAAU,iBAAgB,CAAG;AACtE,AAAI,QAAA,CAAA,qBAAoB,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,oBAAmB,kBAAkB,CAAC,CAAC;AACtF,AAAI,QAAA,CAAA,gBAAe,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,eAAc,aAAa,CAAC,CAAC;AACvE,iBAAW,WAAW,QAAQ,AAAC,CAAC,IAAG,eAAe,CAAG,UAAU,IAAG,CAAG,CAAA,IAAG,CAAG;AAAE,uBAAe,QAAQ,AAAC,CAAC,IAAG,CAAG,KAAG,CAAC,CAAC;MAAE,CAAC,CAAC;AACrH,iBAAW,WAAW,QAAQ,AAAC,CAAC,IAAG,mBAAmB,CAAG,UAAU,QAAO,CAAG,CAAA,IAAG,CAAG;AAAE,uBAAe,kBAAkB,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;MAAE,CAAC,CAAC;AAC3I,iBAAW,WAAW,QAAQ,AAAC,CAAC,IAAG,oBAAoB,CAAG,UAAU,SAAQ,CAAG,CAAA,SAAQ,CAAG;AACtF,mBAAW,WAAW,QAAQ,AAAC,CAAC,SAAQ,CAAG,UAAU,EAAC,CAAG,CAAA,IAAG,CAAG;AAC3D,yBAAe,sBAAsB,AAAC,CAAC,SAAQ,CAAG,KAAG,CAAG,GAAC,CAAC,CAAC;QAC/D,CAAC,CAAC;MACN,CAAC,CAAC;AACF,SAAG,mBAAmB,QAAQ,AAAC,CAAC,SAAU,QAAO,CAAG,CAAA,IAAG,CAAG;AACtD,aAAO,CAAA,qBAAoB,oBAAoB,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;MACpE,CAAC,CAAC;AACF,SAAG,uBAAuB,QAAQ,AAAC,CAAC,SAAU,QAAO,CAAG,CAAA,IAAG,CAAG;AAAE,aAAO,CAAA,qBAAoB,wBAAwB,AAAC,CAAC,IAAG,CAAG,SAAO,CAAC,CAAC;MAAE,CAAC,CAAC;AACxI,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,MAAK,EAAI,CAAA,kBAAiB,EAAE,CAAC;AAC5C,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,OAAM,GAAG,AAAC,CAAC,YAAW,EAAI,SAAO,CAAA,CAAI,YAAU,CAAC,CAAC;AAC9D,AAAI,QAAA,CAAA,GAAE,EAAI,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,QAAO,SAAS,CAAC,CAAC;AAE/C,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,aAAY,IAAI,iBAAiB,AAAC,CAAC,GAAE,CAAG,aAAW,CAAC,CAAC;AACpE,UAAS,GAAA,CAAA,CAAA,EAAI,EAAA,CAAG,CAAA,CAAA,EAAI,CAAA,QAAO,OAAO,CAAG,CAAA,CAAA,EAAE,CAAG;AACtC,oBAAY,IAAI,OAAO,AAAC,CAAC,QAAO,CAAE,CAAA,CAAC,CAAC,CAAC;MACzC;AAAA,AACA,kBAAY,IAAI,YAAY,AAAC,CAAC,GAAE,KAAK,CAAG,OAAK,CAAC,CAAC;AAC/C,WAAO,CAAA,IAAG,UAAU,IAAI,AAAC,CAAC,0BAAyB,uBAAuB,CAAC,WAC7D,AAAC,CAAC,iBAAgB,CAAG,CAAA,GAAE,EAAI,SAAO,CAAG,CAAA,IAAG,UAAU,CAAC,KACzD,AAAC,CAAC,SAAU,YAAW,CAAG;AAAE,aAAO,IAAI,kBAAgB,AAAC,CAAC,YAAW,CAAC,CAAC;MAAE,CAAC,CAAC;IACtF,CAAC;AACD,uBAAmB,EAAI,CAAA,UAAS,AAAC,CAAC,CAC9B,IAAG,WAAW,AAAC,EAAC,CAChB,CAAA,UAAS,AAAC,CAAC,mBAAkB,CAAG,EAAC,IAAG,SAAS,CAAC,CAAC,CACnD,CAAG,qBAAmB,CAAC,CAAC;AACxB,SAAO,qBAAmB,CAAC;EAC/B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,qBAAqB,EAAI,qBAAmB,CAAC;AArLnD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAqL8B;ACtLjD,KAAK,SAAS,AAAC,CAAC,qCAAoC,CAAG,EAAC,sBAAqB,CAAE,0BAAwB,CAAE,yCAAuC,CAAE,2CAAyC,CAAE,sCAAoC,CAAE,0CAAwC,CAAE,sDAAoD,CAAE,sCAAoC,CAAE,oDAAkD,CAAE,2CAAyC,CAAE,gDAA8C,CAAE,2CAAyC,CAAE,sDAAoD,CAAE,+BAA6B,CAAE,kDAAgD,CAAE,0CAAwC,CAAE,0CAAwC,CAAE,uDAAqD,CAAE,2DAAyD,CAAE,sDAAoD,CAAE,iCAA+B,CAAE,oCAAkC,CAAE,oDAAkD,CAAE,4CAA0C,CAAE,uCAAqC,CAAE,oCAAkC,CAAE,2CAAyC,CAAE,wCAAsC,CAAE,iCAA+B,CAAE,+CAA6C,CAAE,uBAAqB,CAAE,0BAAwB,CAAE,sCAAoC,CAAE,gCAA8B,CAAE,uCAAqC,CAAE,0CAAwC,CAAE,gDAA8C,CAAE,gDAA8C,CAAE,+BAA6B,CAAE,kCAAgC,CAAE,8DAA4D,CAAE,kEAAgE,CAAE,6CAA2C,CAAE,8BAA4B,CAAE,iCAA+B,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAt7D,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,yBAAwB,CAAC,CAAC;AAChD,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,wCAAuC,CAAC,CAAC;AAC3E,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AAClF,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AAC/D,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACrE,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,OAAM,AAAC,CAAC,qDAAoD,CAAC,CAAC;AACvF,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mDAAkD,CAAC,CAAC;AAChF,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AACzE,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA8C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AACzE,AAAI,IAAA,CAAA,0BAAyB,EAAI,CAAA,OAAM,AAAC,CAAC,qDAAoD,CAAC,CAAC;AAC/F,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,sBAAqB,EAAI,CAAA,OAAM,AAAC,CAAC,iDAAgD,CAAC,CAAC;AACvF,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACvE,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACvE,AAAI,IAAA,CAAA,2BAA0B,EAAI,CAAA,OAAM,AAAC,CAAC,sDAAqD,CAAC,CAAC;AACjG,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,0DAAyD,CAAC,CAAC;AAC9F,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,qDAAoD,CAAC,CAAC;AACpF,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AACzD,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,mDAAkD,CAAC,CAAC;AAClF,AAAI,IAAA,CAAA,yBAAwB,EAAI,CAAA,OAAM,AAAC,CAAC,2CAA0C,CAAC,CAAC;AACpF,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,sCAAqC,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAC7D,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,0CAAyC,CAAC,CAAC;AAClF,AAAI,IAAA,CAAA,mBAAkB,EAAI,CAAA,OAAM,AAAC,CAAC,uCAAsC,CAAC,CAAC;AAC1E,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AAC9D,AAAI,IAAA,CAAA,wBAAuB,EAAI,CAAA,OAAM,AAAC,CAAC,8CAAyB,CAAC,CAAC;AAClE,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,yBAAwB,CAAC,CAAC;AAChD,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,OAAM,AAAC,CAAC,sCAAqC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,cAAa,EAAI,CAAA,OAAM,AAAC,CAAC,yCAAwC,CAAC,CAAC;AACvE,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA8C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,oBAAmB,EAAI,CAAA,OAAM,AAAC,CAAC,+CAA8C,CAAC,CAAC;AACnF,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,AAAC,CAAC,8BAA6B,CAAC,CAAC;AACnD,AAAI,IAAA,CAAA,QAAO,EAAI,CAAA,OAAM,AAAC,CAAC,iCAAgC,CAAC,CAAC;AACzD,AAAI,IAAA,CAAA,yBAAwB,EAAI,CAAA,OAAM,AAAC,CAAC,6DAA4D,CAAC,CAAC;AACtG,AAAI,IAAA,CAAA,6BAA4B,EAAI,CAAA,OAAM,AAAC,CAAC,iEAAgE,CAAC,CAAC;AAC9G,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,4CAA2C,CAAC,CAAC;AACxE,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,6BAAQ,CAAC,CAAC;AAChC,AAAI,IAAA,CAAA,UAAS,EAAI,CAAA,OAAM,AAAC,CAAC,gCAA+B,CAAC,CAAC;AAQ1D,SAAS,iBAAe,CAAC,AAAC,CAAE;AACxB,SAAO,EACH,IAAG,KAAK,AAAC,CAAC,YAAW,UAAU,CAAC,QACrB,AAAC,CAAC,YAAW,UAAU,CAAC,CACvC,CAAC;EACL;AAAA,AAQA,SAAS,gBAAc,CAAC,AAAC,CAAE;AACvB,AAAI,MAAA,CAAA,MAAK,CAAC;AAEV,MAAI;AACA,WAAK,EAAI,CAAA,aAAY,IAAI,WAAW,AAAC,EAAC,CAAC;IAC3C,CACA,OAAO,CAAA,CAAG;AACN,WAAK,EAAI,KAAG,CAAC;IACjB;AAAA,AACA,SAAO,EACH,UAAS,iBAAiB,AAAC,EAAC,CAC5B,CAAA,IAAG,KAAK,AAAC,CAAC,QAAO,SAAS,CAAC,QAAQ,AAAC,CAAC,MAAK,CAAC,CAC3C,CAAA,QAAO,YAAY,CACnB,CAAA,IAAG,KAAK,AAAC,CAAC,KAAI,SAAS,CAAC,QAAQ,AAAC,CAAC,QAAO,YAAY,CAAC,CACtD,CAAA,IAAG,KAAK,AAAC,CAAC,QAAO,OAAO,CAAC,QAAQ,AAAC,CAAC,GAAE,CAAC,CACtC,CAAA,QAAO,eAAe,CACtB,CAAA,IAAG,KAAK,AAAC,CAAC,QAAO,oCAAoC,CAAC,QAAQ,AAAC,CAAC,CAAC,CAAA,CAAC,CAClE,CAAA,QAAO,mBAAmB,CAC1B,CAAA,IAAG,KAAK,AAAC,CAAC,KAAI,eAAe,CAAC,QAAQ,AAAC,CAAC,QAAO,mBAAmB,CAAC,CACnE,CAAA,IAAG,KAAK,AAAC,CAAC,yBAAwB,sBAAsB,CAAC,QAAQ,AAAC,CAAC,GAAI,CAAA,6BAA4B,yBAAyB,AAAC,EAAC,CAAC,CAC/H,CAAA,QAAO,oBAAoB,CAC3B,CAAA,IAAG,KAAK,AAAC,CAAC,QAAO,iBAAiB,CAAC,QAAQ,AAAC,CAAC,QAAO,oBAAoB,CAAC,CACzE,CAAA,oBAAmB,iBAAiB,CACpC,CAAA,WAAU,YAAY,CACtB,CAAA,cAAa,eAAe,CAC5B,CAAA,oBAAmB,oBAAoB,CACvC,CAAA,YAAW,WAAW,CACtB,CAAA,OAAM,uBAAuB,CAC7B,CAAA,IAAG,KAAK,AAAC,CAAC,WAAU,uBAAuB,CAAC,QAAQ,AAAC,CAAC,GAAE,CAAC,CACzD,CAAA,UAAS,SAAS,CAClB,CAAA,UAAS,cAAc,CACvB,CAAA,IAAG,KAAK,AAAC,CAAC,oBAAmB,kBAAkB,CAAC,QAAQ,AAAC,CAAC,yBAAwB,sBAAsB,CAAC,CACzG,CAAA,IAAG,KAAK,AAAC,CAAC,eAAc,aAAa,CAAC,QAAQ,AAAC,CAAC,oBAAmB,iBAAiB,CAAC,CACrF,CAAA,OAAM,cAAc,CACpB,CAAA,IAAG,KAAK,AAAC,CAAC,kBAAiB,gBAAgB,CAAC,QAAQ,AAAC,CAAC,kBAAiB,uBAAuB,CAAC,CAC/F,CAAA,IAAG,KAAK,AAAC,CAAC,kBAAiB,gBAAgB,CAAC,QAAQ,AAAC,CAAC,kBAAiB,uBAAuB,CAAC,CAC/F,CAAA,IAAG,KAAK,AAAC,CAAC,kBAAiB,gBAAgB,CAAC,QAAQ,AAAC,CAAC,GAAI,CAAA,kBAAiB,uBAAuB,AAAC,EAAC,CAAC,CACrG,CAAA,OAAM,IAAI,CACV,CAAA,aAAY,WAAW,CACvB,CAAA,0BAAyB,uBAAuB,CAChD,CAAA,eAAc,aAAa,CAC3B,CAAA,kBAAiB,OAAO,CACxB,CAAA,kBAAiB,MAAM,CACvB,CAAA,IAAG,KAAK,AAAC,CAAC,YAAW,iBAAiB,CAAC,QAAQ,AAAC,CAAC,GAAI,CAAA,YAAW,iBAAiB,AAAC,CAAC,aAAY,IAAI,CAAC,CAAC,CACrG,CAAA,IAAG,KAAK,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,QAAQ,AAAC,CAAC,wBAAuB,qBAAqB,CAAC,CACrG,CAAA,IAAG,KAAK,AAAC,CAAC,KAAI,IAAI,CAAC,QAAQ,AAAC,CAAC,UAAS,QAAQ,CAAC,CAC/C,CAAA,sBAAqB,mBAAmB,CACxC,CAAA,cAAa,YAAY,CACzB,CAAA,2BAA0B,sBAAsB,CAChD,CAAA,IAAG,KAAK,AAAC,CAAC,cAAa,WAAW,CAAC,QAAQ,AAAC,CAAC,2BAA0B,sBAAsB,CAAC,CAC9F,CAAA,oBAAmB,iBAAiB,CACpC,CAAA,eAAc,aAAa,CAC3B,CAAA,wBAAuB,qBAAqB,CAC5C,CAAA,IAAG,KAAK,AAAC,CAAC,SAAQ,OAAO,CAAC,QAAQ,AAAC,CAAC,cAAa,WAAW,CAAC,CAC7D,CAAA,IAAG,KAAK,AAAC,CAAC,mBAAkB,iBAAiB,CAAC,QAAQ,AAAC,CAAC,wBAAuB,qBAAqB,CAAC,CACrG,CAAA,eAAc,aAAa,CAC3B,IAAI,CAAA,IAAG,QAAQ,AAAC,CAAC,eAAc,sBAAsB,CAAG;AAAE,YAAM,CAAG,CAAA,eAAc,gBAAgB;AAAG,UAAI,CAAG,KAAG;AAAA,IAAE,CAAC,CACrH,CAAC;EACL;AAAA,AACA,SAAS,mBAAiB,CAAE,QAAO,CAAG;AAClC,AAAI,MAAA,CAAA,YAAW,EAAI,CAAA,IAAG,SAAS,iBAAiB,AAAC,CAAC,gBAAe,AAAC,EAAC,CAAC,CAAC;AACrE,SAAO,CAAA,YAAW,sBAAsB,AAAC,CAAC,YAAW,YAAY,OAAO,AAAC,CAAC,eAAc,AAAC,EAAC,CAAG,SAAO,CAAC,CAAC,CAAC;EAC3G;AAAA,AACA,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AA8B/C,SAAS,OAAK,CAAE,MAAK,CAAG,CAAA,EAAC,CAAG;AACxB,SAAO,IAAI,wBAAsB,AAAC,CAAC,MAAK,CAAG,GAAC,CAAC,CAAC;EAClD;AAAA,AACA,QAAM,OAAO,EAAI,OAAK,CAAC;AACvB,AAAI,IAAA,CAAA,uBAAsB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACvC,WAAS,wBAAsB,CAAE,OAAM,CAAG,CAAA,GAAE,CAAG;AAC3C,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,IAAI,EAAI,IAAE,CAAC;IAClB;AAAA,AAIA,0BAAsB,UAAU,QAAQ,EAAI,UAAU,QAAO,CAAG;AAC5D,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,YAAW,YAAY,IAAI,AAAC,CAAC,IAAG,QAAQ,CAAG,UAAU,CAAA,CAAG;AAAE,aAAO,CAAA,QAAO,IAAI,AAAC,CAAC,CAAA,CAAC,CAAC;MAAE,CAAC,CAAC;AACjG,WAAO,CAAA,MAAK,gBAAgB,MAAM,AAAC,CAAC,IAAG,IAAI,CAAG,OAAK,CAAC,CAAC;IACzD,CAAC;AACD,0BAAsB,UAAU,SAAS,EAAI,UAAU,KAAI,CAAG;AAAE,WAAO,CAAA,IAAG,QAAQ,QAAQ,AAAC,CAAC,KAAI,CAAC,CAAA,CAAI,EAAC,CAAA,CAAC;IAAE,CAAC;AAC1G,SAAO,wBAAsB,CAAC;EAClC,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,wBAAwB,EAAI,wBAAsB,CAAC;AAjLzD,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAiLqB;AClLxC,KAAK,SAAS,AAAC,CAAC,gCAA+B,CAAG,EAAC,mCAAkC,CAAE,sCAAoC,CAAE,gCAA8B,CAAE,uBAAqB,CAAE,sCAAoC,CAAE,8BAA4B,CAAE,sCAAoC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAtU,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AAAzB,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,AAAC,CAAC,mCAAkC,CAAC,CAAC;AAChE,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAoC,CAAC,CAAC;AACjE,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,AAAC,CAAC,+BAA8B,CAAC,CAAC;AACrD,AAAI,IAAA,CAAA,IAAG,EAAI,CAAA,OAAM,AAAC,CAAC,sBAAqB,CAAC,CAAC;AAC1C,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAgB,CAAC,CAAC;AAChD,AAAI,IAAA,CAAA,OAAM,EAAI,CAAA,OAAM,AAAC,CAAC,6BAAQ,CAAC,CAAC;AAChC,AAAI,IAAA,CAAA,eAAc,EAAI,CAAA,OAAM,AAAC,CAAC,qCAAgB,CAAC,CAAC;AAChD,QAAM,OAAO,EAAI,CAAA,eAAc,OAAO,CAAC;AACvC,QAAM,MAAM,EAAI,UAAU,CAAA,CAAG;AAAE,SAAO,EAAA,CAAC;EAAE,CAAC;AAC1C,AAAI,IAAA,CAAA,OAAM,EAAI,EAAC,MAAO,OAAK,CAAA,GAAM,YAAU,CAAA,CAAI,CAAA,MAAK,OAAO,EAAI,OAAK,CAAC,CAAC;AACtE,QAAM,UAAU,EAAI,CAAA,OAAM,UAAU,CAAC;AACrC,QAAM,OAAO,EAAI,CAAA,OAAM,OAAO,CAAC;AAC/B,AAAI,IAAA,CAAA,kBAAiB,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAClC,WAAS,mBAAiB,CAAE,KAAI,CAAG;AAC/B,SAAG,MAAM,EAAI,MAAI,CAAC;IACtB;AAAA,AACA,qBAAiB,UAAU,KAAK,EAAI,UAAS,AAAC,CAAE;AAAE,SAAG,MAAM,AAAC,EAAC,CAAC;IAAE,CAAC;AACjE,SAAO,mBAAiB,CAAC;EAC7B,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAC/C,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,WAAW,CAAC;AACtC,AAAI,IAAA,CAAA,WAAU,EAAI,CAAA,OAAM,SAAS,CAAC;AAClC,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,UAAU,CAAC;AACpC,AAAI,IAAA,CAAA,YAAW,EAAI,CAAA,OAAM,UAAU,CAAC;AACpC,AAAI,IAAA,CAAA,KAAI,EAAI,CAAA,OAAM,GAAG,CAAC;AACtB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,IAAI,CAAC;AACxB,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,OAAM,IAAI,CAAC;AACxB,AAAI,IAAA,CAAA,WAAU,EAAI,GAAC,CAAC;AACpB,AAAI,IAAA,CAAA,IAAG,EAAI,MAAI,CAAC;AAChB,AAAI,IAAA,CAAA,aAAY,EAAI,CAAA,OAAM,iBAAiB,OAAO,EAAI,KAAG,EAAI,CAAA,OAAM,yBAAyB,CAAC;AAC7F,AAAI,IAAA,CAAA,YAAW,CAAC;AAMhB,AAAI,IAAA,CAAA,gBAAe,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AAChC,WAAS,iBAAe,CAAE,OAAM,CAAG;AAC/B,SAAG,QAAQ,EAAI,QAAM,CAAC;AACtB,SAAG,KAAK,EAAI,GAAC,CAAC;IAClB;AAAA,AACA,mBAAe,UAAU,WAAW,EAAI,UAAU,EAAC,CAAG;AAAE,SAAG,KAAK,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;IAAE,CAAC;AAC7E,mBAAe,UAAU,IAAI,EAAI,UAAU,QAAO,CAAG;AACjD,SAAI,IAAG,QAAQ;AACX,WAAG,QAAQ,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AAAA,AAC9B,SAAG,KAAK,QAAQ,AAAC,CAAC,SAAU,EAAC,CAAG;AAC5B,aAAO,CAAA,MAAK,WAAW,AAAC,CAAC,EAAC,CAAC,CAAA,CAAI,CAAA,EAAC,AAAC,EAAC,CAAA,CAAI,CAAA,EAAC,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;MAC9D,CAAC,CAAC;IACN,CAAC;AACD,SAAO,iBAAe,CAAC;EAC3B,CAAC,AAAC,EAAC,CAAC;AAEJ,cAAY,AAAC,CAAC,SAAS,AAAC,CAAE;AAAE,eAAW,EAAI,GAAC,CAAC;EAAE,CAAC,CAAC;AACjD,SAAS,UAAQ,CAAE,KAAI,CAAG;AACtB,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACI,MAAA,CAAA,YAAW,EAAI,CAAA,WAAU,OAAO,IAAM,EAAA,CAAA,CAAI,KAAG,EAAI,CAAA,WAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AACxF,AAAI,MAAA,CAAA,MAAK,EAAI,IAAI,iBAAe,AAAC,CAAC,YAAW,CAAC,CAAC;AAC/C,cAAU,KAAK,AAAC,CAAC,MAAK,CAAC,CAAC;AACxB,AAAI,MAAA,CAAA,KAAI,EAAI,CAAA,KAAI,MAAM,AAAC,CAAC,IAAK,EAAA,CAAG,KAAG,CAAC,CAAC;AACrC,cAAU,IAAI,AAAC,EAAC,CAAC;AACjB,SAAO,MAAI,CAAC;EAChB;AAAA,AACA,SAAS,SAAO,CAAC,AAAC,CAAE;AAChB,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACA,SAAO,CAAA,SAAQ,MAAM,AAAC,CAAC,IAAK,EAAA,CAAG,CAAA,CAAC,WAAU,CAAC,OAAO,AAAC,CAAC,IAAG,CAAC,CAAC,CAAC;EAC9D;AAAA,AACA,QAAM,SAAS,EAAI,SAAO,CAAC;AAC3B,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACA,SAAO,CAAA,SAAQ,MAAM,AAAC,CAAC,IAAK,EAAA,CAAG,CAAA,CAAC,YAAW,CAAC,OAAO,AAAC,CAAC,IAAG,CAAC,CAAC,CAAC;EAC/D;AAAA,AACA,QAAM,UAAU,EAAI,UAAQ,CAAC;AAC7B,SAAS,UAAQ,CAAC,AAAC,CAAE;AACjB,AAAI,MAAA,CAAA,IAAG,EAAI,GAAC,CAAC;AACb,QAAS,GAAA,CAAA,EAAC,EAAI,EAAA,CAAG,CAAA,EAAC,EAAI,CAAA,SAAQ,OAAO,CAAG,CAAA,EAAC,EAAE,CAAG;AAC1C,SAAG,CAAE,EAAC,EAAI,EAAA,CAAC,EAAI,CAAA,SAAQ,CAAE,EAAC,CAAC,CAAC;IAChC;AAAA,AACA,SAAO,CAAA,SAAQ,MAAM,AAAC,CAAC,IAAK,EAAA,CAAG,CAAA,CAAC,YAAW,CAAC,OAAO,AAAC,CAAC,IAAG,CAAC,CAAC,CAAC;EAC/D;AAAA,AACA,QAAM,UAAU,EAAI,UAAQ,CAAC;AAC7B,SAAS,WAAS,CAAE,EAAC,CAAG;AACpB,OAAI,WAAU,OAAO,EAAI,EAAA,CAAG;AAExB,gBAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,WAAW,AAAC,CAAC,EAAC,CAAC,CAAC;IACtD,KACK;AAED,kBAAY,AAAC,CAAC,EAAC,CAAC,CAAC;IACrB;AAAA,EACJ;AAAA,AACA,QAAM,WAAW,EAAI,WAAS,CAAC;AAa/B,SAAS,mBAAiB,CAAE,EAAC,CAAG;AAC5B,gBAAY,AAAC,CAAC,SAAS,AAAC,CAAE;AACtB,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,EAAC,AAAC,EAAC,CAAC;AACnB,SAAI,CAAC,QAAO;AACR,eAAM;AAAA,AACV,iBAAW,EAAI,CAAA,YAAW,OAAO,AAAC,CAAC,QAAO,CAAC,CAAC;IAChD,CAAC,CAAC;EACN;AAAA,AACA,QAAM,mBAAmB,EAAI,mBAAiB,CAAC;AAC/C,SAAS,IAAE,CAAE,KAAI,CAAG,CAAA,IAAG,CAAG,CAAA,MAAK,CAAG,CAAA,WAAU,CAAG;AAC3C,AAAI,MAAA,CAAA,MAAK,EAAI,CAAA,WAAU,CAAE,WAAU,OAAO,EAAI,EAAA,CAAC,CAAC;AAChD,AAAI,MAAA,CAAA,OAAM,EAAI,CAAA,MAAK,KAAK,IAAI,AAAC,CAAC,aAAY,CAAG,YAAU,CAAC,CAAC;AACzD,OAAI,MAAK,WAAa,CAAA,eAAc,wBAAwB,CAAG;AAG3D,SAAI,MAAK,SAAS,AAAC,CAAC,kBAAiB,CAAC,CAAG;AACrC,YAAI,AAAC,CAAC,IAAG,CAAG,UAAU,IAAG,CAAG;AACxB,AAAI,YAAA,CAAA,gBAAe,EAAI,CAAA,IAAG,KAAK,AAAC,CAAC,kBAAiB,CAAC,UACtC,AAAC,CAAC,SAAS,AAAC,CAAE;AAEvB,eAAI,CAAC,IAAG;AACJ,kBAAM,IAAI,MAAI,AAAC,CAAC,sDAAqD,CAAC,CAAC;AAAA,AAC3E,iBAAO,IAAI,mBAAiB,AAAC,CAAC,IAAG,CAAC,CAAC;UACvC,CAAC,CAAC;AACF,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,eAAc,mBAAmB,AAAC,CAAC,YAAW,OAAO,AAAC,CAAC,CAAC,gBAAe,CAAC,CAAC,CAAC,CAAC;AAC1F,eAAK,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,aAAG,EAAI,KAAG,CAAC;AACX,eAAK,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;AACxB,aAAG,EAAI,MAAI,CAAC;QAChB,CAAG,QAAM,CAAC,CAAC;MACf,KACK;AACD,YAAI,AAAC,CAAC,IAAG,CAAG,UAAS,AAAC,CAAE;AACpB,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,eAAc,mBAAmB,AAAC,CAAC,YAAW,CAAC,CAAC;AAC/D,eAAK,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,eAAK,QAAQ,AAAC,CAAC,QAAO,CAAC,CAAC;QAC5B,CAAG,QAAM,CAAC,CAAC;MACf;AAAA,IACJ,KACK;AAED,SAAI,MAAK,OAAO,IAAM,EAAA,CAAG;AACrB,YAAI,AAAC,CAAC,IAAG,CAAG,UAAS,AAAC,CAAE;AACpB,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,eAAc,mBAAmB,AAAC,CAAC,YAAW,CAAC,CAAC;AAC/D,eAAK,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,eAAK,AAAC,EAAC,CAAC;QACZ,CAAG,QAAM,CAAC,CAAC;MACf,KACK;AACD,YAAI,AAAC,CAAC,IAAG,CAAG,UAAU,IAAG,CAAG;AACxB,AAAI,YAAA,CAAA,QAAO,EAAI,CAAA,eAAc,mBAAmB,AAAC,CAAC,YAAW,CAAC,CAAC;AAC/D,eAAK,IAAI,AAAC,CAAC,QAAO,CAAC,CAAC;AACpB,eAAK,AAAC,CAAC,IAAG,CAAC,CAAC;QAChB,CAAG,QAAM,CAAC,CAAC;MACf;AAAA,IACJ;AAAA,EACJ;AAAA,AACA,SAAS,GAAC,CAAE,IAAG,CAAG,CAAA,EAAC,CAAG,CAAA,OAAM,CAAG;AAC3B,OAAI,OAAM,IAAM,KAAK,EAAA,CAAG;AAAE,YAAM,EAAI,KAAG,CAAC;IAAE;AAAA,AAC1C,SAAO,CAAA,GAAE,AAAC,CAAC,KAAI,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACxC;AAAA,AACA,QAAM,GAAG,EAAI,GAAC,CAAC;AACf,SAAS,IAAE,CAAE,IAAG,CAAG,CAAA,EAAC,CAAG,CAAA,OAAM,CAAG;AAC5B,OAAI,OAAM,IAAM,KAAK,EAAA,CAAG;AAAE,YAAM,EAAI,KAAG,CAAC;IAAE;AAAA,AAC1C,SAAO,CAAA,GAAE,AAAC,CAAC,MAAK,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACzC;AAAA,AACA,QAAM,IAAI,EAAI,IAAE,CAAC;AACjB,SAAS,IAAE,CAAE,IAAG,CAAG,CAAA,EAAC,CAAG,CAAA,OAAM,CAAG;AAC5B,OAAI,OAAM,IAAM,KAAK,EAAA,CAAG;AAAE,YAAM,EAAI,KAAG,CAAC;IAAE;AAAA,AAC1C,SAAO,CAAA,GAAE,AAAC,CAAC,MAAK,CAAG,KAAG,CAAG,GAAC,CAAG,QAAM,CAAC,CAAC;EACzC;AAAA,AACA,QAAM,IAAI,EAAI,IAAE,CAAC;AAKjB,IAAE,UAAU,CAAE,iBAAgB,CAAC,EAAI,UAAS,AAAC,CAAE;AAC3C,AAAI,MAAA,CAAA,CAAA,EAAI,KAAG,CAAC;AACZ,OAAI,CAAC,CAAA,CAAG;AACJ,WAAO,CAAA,EAAC,EAAI,EAAA,CAAC;IACjB;AAAA,AACI,MAAA,CAAA,GAAE,EAAI,GAAC,CAAC;AACZ,IAAA,QAAQ,AAAC,CAAC,SAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,QAAE,KAAK,AAAC,CAAC,CAAA,EAAI,IAAE,CAAA,CAAI,EAAA,CAAC,CAAC;IAAE,CAAC,CAAC;AACrD,SAAO,CAAA,IAAG,EAAI,CAAA,GAAE,KAAK,AAAC,CAAC,GAAE,CAAC,CAAA,CAAI,KAAG,CAAC;EACtC,CAAC;AACD,QAAM,WAAW,AAAC,CAAC,SAAS,AAAC,CAAE;AAC3B,UAAM,YAAY,AAAC,CAAC;AAEhB,YAAM,CAAG,UAAU,IAAG,CAAG,CAAA,qBAAoB,CAAG;AAC5C,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,QAAO,CAAG;AACjC,iBAAO,EAAE,IAAG,CAAG,CAAA,IAAG,OAAO,AAAC,CAAC,MAAK,CAAG,SAAO,CAAG,EAAC,UAAS,CAAC,CAAC,CAAE,CAAC;UAChE,CACJ,CAAC;AACD,eAAS,WAAS,CAAE,MAAK,CAAG,CAAA,QAAO,CAAG;AAClC,aAAI,MAAK,WAAa,IAAE,CAAG;AACvB,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,MAAK,KAAK,IAAM,CAAA,QAAO,KAAK,CAAC;AACxC,eAAI,IAAG,CAAG;AACN,mBAAK,QAAQ,AAAC,CAAC,SAAU,CAAA,CAAG,CAAA,CAAA,CAAG;AAAE,mBAAG,EAAI,CAAA,IAAG,GAAK,CAAA,IAAG,OAAO,AAAC,CAAC,CAAA,CAAG,CAAA,QAAO,IAAI,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC;cAAE,CAAC,CAAC;YACvF;AAAA,AACA,iBAAO,KAAG,CAAC;UACf,KACK;AACD,iBAAO,UAAQ,CAAC;UACpB;AAAA,QACJ;AAAA,MACJ;AACA,gBAAU,CAAG,UAAS,AAAC,CAAE;AACrB,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,aAAY,CAAG;AACtC,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,MAAO,OAAK,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAO,OAAK,KAAK,CAAA,GAAM,WAAS,CAAC;AAC1E,iBAAO;AAAE,iBAAG,CAAG,KAAG;AAAG,gBAAI,QAAM,EAAI;AAAE,qBAAO,CAAA,WAAU,EAAI,OAAK,CAAA,CAAI,mBAAiB,CAAC;cAAE;AAAA,YAAE,CAAC;UAC9F,CACJ,CAAC;MACL;AACA,qBAAe,CAAG,UAAS,AAAC,CAAE;AAC1B,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,aAAY,CAAG;AACtC,AAAI,cAAA,CAAA,IAAG,EAAI,CAAA,MAAO,OAAK,CAAA,GAAM,SAAO,CAAA,EAAK,CAAA,MAAK,WAAa,cAAY,CAAC;AACxE,iBAAO;AACH,iBAAG,CAAG,KAAG;AACT,gBAAI,QAAM,EAAI;AACV,qBAAO,CAAA,WAAU,EAAI,OAAK,CAAA,CAAI,yBAAuB,CAAA,CAAI,cAAY,CAAC;cAC1E;AAAA,YACJ,CAAC;UACL,CACJ,CAAC;MACL;AACA,eAAS,CAAG,UAAS,AAAC,CAAE;AACpB,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,AAAI,cAAA,CAAA,UAAS,EAAI,CAAA,WAAU,AAAC,CAAC,MAAK,CAAC,CAAC;AACpC,iBAAO;AACH,iBAAG,CAAG,CAAA,UAAS,GAAK,aAAW;AAC/B,gBAAI,QAAM,EAAI;AAAE,qBAAO,CAAA,WAAU,EAAI,WAAS,CAAA,CAAI,mBAAiB,CAAA,CAAI,aAAW,CAAC;cAAE;AAAA,YACzF,CAAC;UACL,CACJ,CAAC;MACL;AACA,mBAAa,CAAG,UAAS,AAAC,CAAE;AACxB,aAAO;AAAE,gBAAM,CAAG,CAAA,UAAS,AAAC,CAAC,KAAI,CAAC;AAAG,wBAAc,CAAG,CAAA,UAAS,AAAC,CAAC,IAAG,CAAC;AAAA,QAAE,CAAC;AACxE,eAAS,WAAS,CAAE,KAAI,CAAG;AACvB,eAAO,UAAU,MAAK,CAAG,CAAA,SAAQ,CAAG;AAChC,iBAAO;AACH,iBAAG,CAAG,CAAA,aAAY,IAAI,SAAS,AAAC,CAAC,MAAK,CAAG,UAAQ,CAAC,CAAA,EAAK,EAAC,KAAI;AAC5D,gBAAI,QAAM,EAAI;AACV,qBAAO,CAAA,WAAU,EAAI,CAAA,MAAK,UAAU,CAAA,CAAI,IAAE,CAAA,CAAI,EAAC,KAAI,EAAI,OAAK,EAAI,GAAC,CAAC,CAAA,CAAI,8BAA4B,CAAA,CAAI,UAAQ,CAAA,CAAI,KAAG,CAAC;cAC1H;AAAA,YACJ,CAAC;UACL,CAAC;QACL;AAAA,MACJ;AACA,mBAAa,CAAG,UAAS,AAAC,CAAE;AACxB,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,AAAI,cAAA,CAAA,YAAW,EAAI,CAAA,MAAK,SAAS,AAAC,EAAC,CAAC;AACpC,iBAAO;AACH,iBAAG,CAAG,CAAA,YAAW,QAAQ,AAAC,CAAC,YAAW,CAAC,CAAA,CAAI,EAAC,CAAA;AAC5C,gBAAI,QAAM,EAAI;AAAE,qBAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,eAAa,CAAA,CAAI,aAAW,CAAC;cAAE;AAAA,YACvF,CAAC;UACL,CACJ,CAAC;MACL;AACA,qBAAe,CAAG,UAAS,AAAC,CAAE;AAC1B,aAAO,EACH,OAAM,CAAG,UAAU,MAAK,CAAG,CAAA,YAAW,CAAG;AACrC,cAAI;AACA,mBAAK,AAAC,EAAC,CAAC;AACR,mBAAO;AACH,mBAAG,CAAG,MAAI;AACV,kBAAI,QAAM,EAAI;AAAE,uBAAO,2CAAyC,CAAC;gBAAE;AAAA,cACvE,CAAC;YACL,CACA,OAAO,CAAA,CAAG;AACN,AAAI,gBAAA,CAAA,YAAW,EAAI,CAAA,CAAA,SAAS,AAAC,EAAC,CAAC;AAC/B,mBAAO;AACH,mBAAG,CAAG,CAAA,YAAW,QAAQ,AAAC,CAAC,YAAW,CAAC,CAAA,CAAI,EAAC,CAAA;AAC5C,kBAAI,QAAM,EAAI;AAAE,uBAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,eAAa,CAAA,CAAI,aAAW,CAAC;gBAAE;AAAA,cACvF,CAAC;YACL;AAAA,UACJ,CACJ,CAAC;MACL;AACA,gBAAU,CAAG,UAAS,AAAC,CAAE;AACrB,aAAO,EACH,OAAM,CAAG,UAAU,YAAW,CAAG,CAAA,iBAAgB,CAAG;AAChD,AAAI,cAAA,CAAA,QAAO,EAAI,CAAA,MAAK,KAAK,AAAC,CAAC,YAAW,YAAY,UAAU,CAAC,CAAC;AAC9D,AAAI,cAAA,CAAA,QAAO,EAAI,CAAA,MAAK,KAAK,AAAC,CAAC,iBAAgB,UAAU,CAAC,CAAC;AACvD,AAAI,cAAA,CAAA,aAAY,EAAI,GAAC,CAAC;AACtB,mBAAO,QAAQ,AAAC,CAAC,SAAU,CAAA,CAAG;AAC1B,iBAAI,CAAC,YAAW,YAAY,UAAU,CAAE,CAAA,CAAC;AACrC,4BAAY,KAAK,AAAC,CAAC,CAAA,CAAC,CAAC;AAAA,YAC7B,CAAC,CAAC;AACF,iBAAO;AACH,iBAAG,CAAG,CAAA,aAAY,OAAO,GAAK,EAAA;AAC9B,gBAAI,QAAM,EAAI;AACV,qBAAO,CAAA,WAAU,EAAI,aAAW,CAAA,CAAI,mCAAiC,CAAA,CACjE,CAAA,aAAY,KAAK,AAAC,CAAC,IAAG,CAAC,CAAC;cAChC;AAAA,YACJ,CAAC;UACL,CACJ,CAAC;MACL;AAAA,IACJ,CAAC,CAAC;EACN,CAAC,CAAC;AACF,AAAI,IAAA,CAAA,SAAQ,EAAI,CAAA,CAAC,SAAS,AAAC,CAAE;AACzB,WAAS,UAAQ,CAAE,IAAG,CAAG;AACrB,SAAI,IAAG,IAAM,KAAK,EAAA,CAAG;AAAE,WAAG,EAAI,KAAG,CAAC;MAAE;AAAA,AACpC,SAAI,IAAG,CAAG;AACN,YAAS,GAAA,CAAA,IAAG,CAAA,EAAK,CAAA,IAAG,UAAU,CAAG;AAC7B,AAAI,YAAA,CAAA,CAAA,EAAI,KAAG,CAAC;AACZ,YAAI;AACA,YAAA,EAAI,CAAA,IAAG,UAAU,CAAE,IAAG,CAAC,CAAC;UAC5B,CACA,OAAO,CAAA,CAAG,GACV;AAAA,AACA,aAAI,MAAO,EAAA,CAAA,GAAM,WAAS,CAAG;AACzB,eAAG,IAAI,AAAC,CAAC,IAAG,CAAC,CAAC;UAClB;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,AAEA,YAAQ,UAAU,aAAa,EAAI,UAAU,IAAG,CAAG,GAAE,CAAC;AACtD,YAAQ,UAAU,IAAI,EAAI,UAAU,IAAG,CAAG;AACtC,SAAI,CAAC,IAAG,CAAE,IAAG,CAAC,CAAG;AACb,WAAG,CAAE,IAAG,CAAC,EAAI,CAAA,IAAG,6BAA6B,AAAC,CAAC,IAAG,CAAC,CAAC;MACxD;AAAA,AACA,WAAO,CAAA,IAAG,CAAE,IAAG,CAAC,CAAC;IACrB,CAAC;AACD,YAAQ,UAAU,KAAK,EAAI,UAAU,IAAG,CAAG,CAAA,KAAI,CAAG;AAAE,SAAG,CAAE,IAAG,CAAC,EAAI,MAAI,CAAC;IAAE,CAAC;AACzE,YAAQ,KAAK,EAAI,UAAU,MAAK,CAAG,CAAA,MAAK,CAAG,CAAA,SAAQ,CAAG;AAClD,SAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,aAAK,EAAI,KAAG,CAAC;MAAE;AAAA,AACxC,SAAI,MAAK,IAAM,KAAK,EAAA,CAAG;AAAE,aAAK,EAAI,KAAG,CAAC;MAAE;AAAA,AACxC,SAAI,SAAQ,IAAM,KAAK,EAAA,CAAG;AAAE,gBAAQ,EAAI,KAAG,CAAC;MAAE;AAAA,AAC9C,SAAI,CAAC,CAAC,MAAK,WAAa,UAAQ,CAAC,CAAG;AAChC,gBAAQ,EAAI,OAAK,CAAC;AAClB,aAAK,EAAI,OAAK,CAAC;AACf,aAAK,EAAI,IAAI,UAAQ,AAAC,EAAC,CAAC;MAC5B;AAAA,AACI,QAAA,CAAA,CAAA,EAAI,CAAA,YAAW,iBAAiB,MAAM,AAAC,CAAC,MAAK,CAAG,UAAQ,CAAC,CAAC;AAC9D,iBAAW,iBAAiB,QAAQ,AAAC,CAAC,CAAA,CAAG,UAAU,KAAI,CAAG,CAAA,GAAE,CAAG;AAAE,aAAK,IAAI,AAAC,CAAC,GAAE,CAAC,UAAU,AAAC,CAAC,KAAI,CAAC,CAAC;MAAE,CAAC,CAAC;AACrG,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,YAAQ,UAAU,6BAA6B,EAAI,UAAU,IAAG,CAAG;AAC/D,AAAI,QAAA,CAAA,MAAK,EAAI,CAAA,OAAM,UAAU,AAAC,CAAC,IAAG,CAAC,CAAC;AACpC,WAAK,YAAY,EAAI,CAAA,MAAK,IAAI,SAAS,CAAC;AACxC,WAAK,UAAU,EAAI,CAAA,MAAK,IAAI,YAAY,CAAC;AACzC,WAAK,MAAM,EAAI,CAAA,MAAK,MAAM,MAAM,CAAC;AAEjC,WAAK,IAAI,YAAY,AAAC,CAAC,IAAG,CAAC,CAAC;AAC5B,WAAO,OAAK,CAAC;IACjB,CAAC;AACD,SAAO,UAAQ,CAAC;EACpB,CAAC,AAAC,EAAC,CAAC;AACJ,QAAM,UAAU,EAAI,UAAQ,CAAC;AAC7B,SAAS,YAAU,CAAE,CAAA,CAAG;AACpB,AAAI,MAAA,CAAA,QAAO,EAAI,UAAU,CAAA,CAAG;AACxB,AAAI,QAAA,CAAA,QAAO,EAAI,CAAA,aAAY,IAAI,WAAW,AAAC,CAAC,CAAA,CAAC,CAAC;AAC9C,WAAO,CAAA,QAAO,GAAK,CAAA,QAAO,OAAO,EAAI,EAAA,CAAC;IAC1C,CAAC;AACD,OAAI,CAAA,WAAa,MAAI,CAAG;AACpB,WAAO,CAAA,CAAA,IAAI,AAAC,CAAC,SAAU,EAAC,CAAG;AAAE,aAAO,CAAA,WAAU,AAAC,CAAC,EAAC,CAAC,CAAC;MAAE,CAAC,KAAK,AAAC,CAAC,EAAC,CAAC,CAAC;IACpE;AAAA,AACA,OAAI,aAAY,IAAI,cAAc,AAAC,CAAC,CAAA,CAAC,CAAG;AACpC,WAAO,GAAC,CAAC;IACb;AAAA,AACA,OAAI,aAAY,IAAI,cAAc,AAAC,CAAC,CAAA,CAAC,CAAA,EAAK,CAAA,aAAY,IAAI,QAAQ,AAAC,CAAC,CAAA,CAAC,CAAA,EAAK,UAAQ,CAAG;AACjF,WAAO,CAAA,WAAU,AAAC,CAAC,KAAI,UAAU,MAAM,MAAM,AAAC,CAAC,aAAY,IAAI,oBAAoB,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;IAC7F;AAAA,AACA,OAAI,aAAY,IAAI,cAAc,AAAC,CAAC,CAAA,CAAC,CAAG;AACpC,WAAO,CAAA,WAAU,AAAC,CAAC,aAAY,IAAI,iBAAiB,AAAC,CAAC,aAAY,IAAI,cAAc,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;IAC9F;AAAA,AACA,OAAI,QAAO,AAAC,CAAC,CAAA,CAAC,CAAG;AACb,WAAO,CAAA,WAAU,AAAC,CAAC,aAAY,IAAI,iBAAiB,AAAC,CAAC,CAAA,CAAC,CAAC,CAAC;IAC7D;AAAA,AACA,SAAO,CAAA,aAAY,IAAI,QAAQ,AAAC,CAAC,CAAA,CAAC,CAAC;EACvC;AAAA,AACA,SAAS,cAAY,CAAC,AAAC,CAAE;AACrB,SAAO,CAAA,MAAK,OAAO,KAAK,WAAW,IAAM,KAAG,CAAC;EACjD;AAAA,AACA,QAAM,cAAc,EAAI,cAAY,CAAC;AA1YrC,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AA0YgB;AC3YnC,KAAK,SAAS,AAAC,CAAC,eAAc,CAAG,EAAC,gCAA+B,CAAE,+CAA6C,CAAE,sCAAoC,CAAE,mCAAiC,CAAC,CAAG,KAAG,CAAG,UAAS,OAAM,CAAG,CAAA,OAAM,CAAG,CAAA,MAAK;AAAnO,AAAI,IAAA,CAAA,MAAK,EAAI,CAAA,MAAK,OAAO;AAAG,aAAO,EAAI,CAAA,MAAK,OAAO,CAAC;AACpD,OAAK,OAAO,EAAI,UAAQ,CAAC;AADzB,SAAS,SAAO,CAAE,CAAA,CAAG;AACjB,QAAS,GAAA,CAAA,CAAA,CAAA,EAAK,EAAA;AAAG,SAAI,CAAC,OAAM,eAAe,AAAC,CAAC,CAAA,CAAC;AAAG,cAAM,CAAE,CAAA,CAAC,EAAI,CAAA,CAAA,CAAE,CAAA,CAAC,CAAC;AAAA,EACtE;AAAA,AASA,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,gCAAwB,CAAC,CAAC,CAAC;AAC5C,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,8CAAsC,CAAC,CAAC,CAAC;AAC1D,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,qCAA6B,CAAC,CAAC,CAAC;AACjD,SAAO,AAAC,CAAC,OAAM,AAAC,CAAC,kCAA0B,CAAC,CAAC,CAAC;AAd9C,OAAK,OAAO,EAAI,SAAO,CAAC;AACxB,OAAO,CAAA,MAAK,QAAQ,CAAC;AAAJ,CAAC,CAAC;AAcY","file":"dist/js/bundle/test_lib.dev.js"} \ No newline at end of file diff --git a/2.0.0-snapshot/web_worker/ui.dev.js b/2.0.0-snapshot/web_worker/ui.dev.js new file mode 100644 index 0000000000..581b132f5c --- /dev/null +++ b/2.0.0-snapshot/web_worker/ui.dev.js @@ -0,0 +1,28378 @@ +/** + @license +Copyright 2014-2015 Google, Inc. http://angularjs.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + */ + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchRequestAnimationFrame(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + + +/** + * requestAnimationFrame is typically recursively called from within the callback function + * that it executes. To handle this case, only fork a zone if this is executed + * within the root zone. + */ +function patchRequestAnimationFrame(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + global.zone[name] = function (fn) { + var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; + if (fn) { + arguments[0] = function () { + return callZone.run(fn, arguments); + }; + } + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchRequestAnimationFrame: patchRequestAnimationFrame, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (utils.isWebWorker()){ + // on WebWorker so don't apply patch + return; + } + + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (supportsWebSocket) { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + webSocketPatch.apply(); + } + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; +var utils = require("../utils"); + +function apply() { + if (utils.isWebWorker() || !('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function isWebWorker() { + return (typeof document === "undefined"); +} + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, handler) { + var fn; + //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (handler.toString() !== "[object FunctionWrapper]") { + if (handler.handleEvent) { + // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in + // IE9 by the arguments[1] assignment at end of this function. + fn = (function(handler) { + return function() { + handler.handleEvent.apply(handler, arguments); + }; + })(handler); + } else { + fn = handler; + } + + handler._fn = fn; + handler._bound = handler._bound || {}; + arguments[1] = handler._bound[eventName] = zone.bind(fn); + } + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, handler) { + if(handler._bound && handler._bound[eventName]) { + var _bound = handler._bound; + + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(handler._fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass, + isWebWorker: isWebWorker +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/di/metadata", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/reflection/reflector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/generic_browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var GenericBrowserDomAdapter = (function(_super) { + __extends(GenericBrowserDomAdapter, _super); + function GenericBrowserDomAdapter() { + var _this = this; + _super.call(this); + this._animationPrefix = null; + this._transitionEnd = null; + try { + var element = this.createElement('div', this.defaultDoc()); + if (lang_1.isPresent(this.getStyle(element, 'animationName'))) { + this._animationPrefix = ''; + } else { + var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; + for (var i = 0; i < domPrefixes.length; i++) { + if (lang_1.isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) { + this._animationPrefix = '-' + lang_1.StringWrapper.toLowerCase(domPrefixes[i]) + '-'; + break; + } + } + } + var transEndEventNames = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + collection_1.StringMapWrapper.forEach(transEndEventNames, function(value, key) { + if (lang_1.isPresent(_this.getStyle(element, key))) { + _this._transitionEnd = value; + } + }); + } catch (e) { + this._animationPrefix = null; + this._transitionEnd = null; + } + } + GenericBrowserDomAdapter.prototype.getDistributedNodes = function(el) { + return el.getDistributedNodes(); + }; + GenericBrowserDomAdapter.prototype.resolveAndSetHref = function(el, baseUrl, href) { + el.href = href == null ? baseUrl : baseUrl + '/../' + href; + }; + GenericBrowserDomAdapter.prototype.cssToRules = function(css) { + var style = this.createStyleElement(css); + this.appendChild(this.defaultDoc().head, style); + var rules = []; + if (lang_1.isPresent(style.sheet)) { + try { + var rawRules = style.sheet.cssRules; + rules = collection_1.ListWrapper.createFixedSize(rawRules.length); + for (var i = 0; i < rawRules.length; i++) { + rules[i] = rawRules[i]; + } + } catch (e) {} + } else {} + this.remove(style); + return rules; + }; + GenericBrowserDomAdapter.prototype.supportsDOMEvents = function() { + return true; + }; + GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function() { + return lang_1.isFunction(this.defaultDoc().body.createShadowRoot); + }; + GenericBrowserDomAdapter.prototype.getAnimationPrefix = function() { + return lang_1.isPresent(this._animationPrefix) ? this._animationPrefix : ""; + }; + GenericBrowserDomAdapter.prototype.getTransitionEnd = function() { + return lang_1.isPresent(this._transitionEnd) ? this._transitionEnd : ""; + }; + GenericBrowserDomAdapter.prototype.supportsAnimation = function() { + return lang_1.isPresent(this._animationPrefix) && lang_1.isPresent(this._transitionEnd); + }; + return GenericBrowserDomAdapter; + })(dom_adapter_1.DomAdapter); + exports.GenericBrowserDomAdapter = GenericBrowserDomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/key_events", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var di_1 = require("angular2/src/core/di"); + var modifierKeys = ['alt', 'control', 'meta', 'shift']; + var modifierKeyGetters = { + 'alt': function(event) { + return event.altKey; + }, + 'control': function(event) { + return event.ctrlKey; + }, + 'meta': function(event) { + return event.metaKey; + }, + 'shift': function(event) { + return event.shiftKey; + } + }; + var KeyEventsPlugin = (function(_super) { + __extends(KeyEventsPlugin, _super); + function KeyEventsPlugin() { + _super.call(this); + } + KeyEventsPlugin.prototype.supports = function(eventName) { + return lang_1.isPresent(KeyEventsPlugin.parseEventName(eventName)); + }; + KeyEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var parsedEvent = KeyEventsPlugin.parseEventName(eventName); + var outsideHandler = KeyEventsPlugin.eventCallback(element, collection_1.StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone()); + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, collection_1.StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler); + }); + }; + KeyEventsPlugin.parseEventName = function(eventName) { + var parts = eventName.toLowerCase().split('.'); + var domEventName = collection_1.ListWrapper.removeAt(parts, 0); + if ((parts.length === 0) || !(lang_1.StringWrapper.equals(domEventName, 'keydown') || lang_1.StringWrapper.equals(domEventName, 'keyup'))) { + return null; + } + var key = KeyEventsPlugin._normalizeKey(collection_1.ListWrapper.removeLast(parts)); + var fullKey = ''; + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (collection_1.ListWrapper.contains(parts, modifierName)) { + collection_1.ListWrapper.remove(parts, modifierName); + fullKey += modifierName + '.'; + } + }); + fullKey += key; + if (parts.length != 0 || key.length === 0) { + return null; + } + var result = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(result, 'domEventName', domEventName); + collection_1.StringMapWrapper.set(result, 'fullKey', fullKey); + return result; + }; + KeyEventsPlugin.getEventFullKey = function(event) { + var fullKey = ''; + var key = dom_adapter_1.DOM.getEventKey(event); + key = key.toLowerCase(); + if (lang_1.StringWrapper.equals(key, ' ')) { + key = 'space'; + } else if (lang_1.StringWrapper.equals(key, '.')) { + key = 'dot'; + } + collection_1.ListWrapper.forEach(modifierKeys, function(modifierName) { + if (modifierName != key) { + var modifierGetter = collection_1.StringMapWrapper.get(modifierKeyGetters, modifierName); + if (modifierGetter(event)) { + fullKey += modifierName + '.'; + } + } + }); + fullKey += key; + return fullKey; + }; + KeyEventsPlugin.eventCallback = function(element, fullKey, handler, zone) { + return function(event) { + if (lang_1.StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) { + zone.run(function() { + return handler(event); + }); + } + }; + }; + KeyEventsPlugin._normalizeKey = function(keyName) { + switch (keyName) { + case 'esc': + return 'escape'; + default: + return keyName; + } + }; + KeyEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], KeyEventsPlugin); + return KeyEventsPlugin; + })(event_manager_1.EventManagerPlugin); + exports.KeyEventsPlugin = KeyEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_common", ["angular2/src/core/render/dom/events/event_manager", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _eventNames = { + 'pan': true, + 'panstart': true, + 'panmove': true, + 'panend': true, + 'pancancel': true, + 'panleft': true, + 'panright': true, + 'panup': true, + 'pandown': true, + 'pinch': true, + 'pinchstart': true, + 'pinchmove': true, + 'pinchend': true, + 'pinchcancel': true, + 'pinchin': true, + 'pinchout': true, + 'press': true, + 'pressup': true, + 'rotate': true, + 'rotatestart': true, + 'rotatemove': true, + 'rotateend': true, + 'rotatecancel': true, + 'swipe': true, + 'swipeleft': true, + 'swiperight': true, + 'swipeup': true, + 'swipedown': true, + 'tap': true + }; + var HammerGesturesPluginCommon = (function(_super) { + __extends(HammerGesturesPluginCommon, _super); + function HammerGesturesPluginCommon() { + _super.call(this); + } + HammerGesturesPluginCommon.prototype.supports = function(eventName) { + eventName = eventName.toLowerCase(); + return collection_1.StringMapWrapper.contains(_eventNames, eventName); + }; + return HammerGesturesPluginCommon; + })(event_manager_1.EventManagerPlugin); + exports.HammerGesturesPluginCommon = HammerGesturesPluginCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/dom_element_schema_registry", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/schema/element_schema_registry"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var DomElementSchemaRegistry = (function(_super) { + __extends(DomElementSchemaRegistry, _super); + function DomElementSchemaRegistry() { + _super.apply(this, arguments); + this._protoElements = new Map(); + } + DomElementSchemaRegistry.prototype._getProtoElement = function(tagName) { + var element = this._protoElements.get(tagName); + if (lang_1.isBlank(element)) { + element = dom_adapter_1.DOM.createElement(tagName); + this._protoElements.set(tagName, element); + } + return element; + }; + DomElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + if (tagName.indexOf('-') !== -1) { + return true; + } else { + var elm = this._getProtoElement(tagName); + return dom_adapter_1.DOM.hasProperty(elm, propName); + } + }; + DomElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + var mappedPropName = collection_1.StringMapWrapper.get(dom_adapter_1.DOM.attrToPropMap, propName); + return lang_1.isPresent(mappedPropName) ? mappedPropName : propName; + }; + return DomElementSchemaRegistry; + })(element_schema_registry_1.ElementSchemaRegistry); + exports.DomElementSchemaRegistry = DomElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr_impl", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/facade/lang", "angular2/src/core/render/xhr"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 async_1 = require("angular2/src/core/facade/async"); + var lang_1 = require("angular2/src/core/facade/lang"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var XHRImpl = (function(_super) { + __extends(XHRImpl, _super); + function XHRImpl() { + _super.apply(this, arguments); + } + XHRImpl.prototype.get = function(url) { + var completer = async_1.PromiseWrapper.completer(); + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, true); + xhr.responseType = 'text'; + xhr.onload = function() { + var response = lang_1.isPresent(xhr.response) ? xhr.response : xhr.responseText; + var status = xhr.status === 1223 ? 204 : xhr.status; + if (status === 0) { + status = response ? 200 : 0; + } + if (200 <= status && status <= 300) { + completer.resolve(response); + } else { + completer.reject("Failed to load " + url, null); + } + }; + xhr.onerror = function() { + completer.reject("Failed to load " + url, null); + }; + xhr.send(); + return completer.promise; + }; + XHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], XHRImpl); + return XHRImpl; + })(xhr_1.XHR); + exports.XHRImpl = XHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/api", ["angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + exports.ON_WEB_WORKER = lang_1.CONST_EXPR(new di_1.OpaqueToken('WebWorker.onWebWorker')); + var WebWorkerElementRef = (function() { + function WebWorkerElementRef(renderView, renderBoundElementIndex) { + this.renderView = renderView; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return WebWorkerElementRef; + })(); + exports.WebWorkerElementRef = WebWorkerElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_proto_view_ref_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var RenderProtoViewRefStore = (function() { + function RenderProtoViewRefStore(onWebworker) { + this._lookupByIndex = new Map(); + this._lookupByProtoView = new Map(); + this._nextIndex = 0; + this._onWebworker = onWebworker; + } + RenderProtoViewRefStore.prototype.storeRenderProtoViewRef = function(ref) { + if (this._lookupByProtoView.has(ref)) { + return this._lookupByProtoView.get(ref); + } else { + this._lookupByIndex.set(this._nextIndex, ref); + this._lookupByProtoView.set(ref, this._nextIndex); + return this._nextIndex++; + } + }; + RenderProtoViewRefStore.prototype.retreiveRenderProtoViewRef = function(index) { + return this._lookupByIndex.get(index); + }; + RenderProtoViewRefStore.prototype.deserialize = function(index) { + if (index == null) { + return null; + } + if (this._onWebworker) { + return new WebWorkerRenderProtoViewRef(index); + } else { + return this.retreiveRenderProtoViewRef(index); + } + }; + RenderProtoViewRefStore.prototype.serialize = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebworker) { + return ref.refNumber; + } else { + return this.storeRenderProtoViewRef(ref); + } + }; + RenderProtoViewRefStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderProtoViewRefStore); + return RenderProtoViewRefStore; + })(); + exports.RenderProtoViewRefStore = RenderProtoViewRefStore; + var WebWorkerRenderProtoViewRef = (function(_super) { + __extends(WebWorkerRenderProtoViewRef, _super); + function WebWorkerRenderProtoViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + return WebWorkerRenderProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.WebWorkerRenderProtoViewRef = WebWorkerRenderProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_view_with_fragments_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var collection_1 = require("angular2/src/core/facade/collection"); + var RenderViewWithFragmentsStore = (function() { + function RenderViewWithFragmentsStore(onWebWorker) { + this._nextIndex = 0; + this._onWebWorker = onWebWorker; + this._lookupByIndex = new Map(); + this._lookupByView = new Map(); + this._viewFragments = new Map(); + } + RenderViewWithFragmentsStore.prototype.allocate = function(fragmentCount) { + var initialIndex = this._nextIndex; + var viewRef = new WebWorkerRenderViewRef(this._nextIndex++); + var fragmentRefs = collection_1.ListWrapper.createGrowableSize(fragmentCount); + for (var i = 0; i < fragmentCount; i++) { + fragmentRefs[i] = new WebWorkerRenderFragmentRef(this._nextIndex++); + } + var renderViewWithFragments = new api_1.RenderViewWithFragments(viewRef, fragmentRefs); + this.store(renderViewWithFragments, initialIndex); + return renderViewWithFragments; + }; + RenderViewWithFragmentsStore.prototype.store = function(view, startIndex) { + var _this = this; + this._lookupByIndex.set(startIndex, view.viewRef); + this._lookupByView.set(view.viewRef, startIndex); + startIndex++; + collection_1.ListWrapper.forEach(view.fragmentRefs, function(ref) { + _this._lookupByIndex.set(startIndex, ref); + _this._lookupByView.set(ref, startIndex); + startIndex++; + }); + this._viewFragments.set(view.viewRef, view.fragmentRefs); + }; + RenderViewWithFragmentsStore.prototype.remove = function(view) { + var _this = this; + this._removeRef(view); + var fragments = this._viewFragments.get(view); + fragments.forEach(function(fragment) { + _this._removeRef(fragment); + }); + collection_1.MapWrapper.delete(this._viewFragments, view); + }; + RenderViewWithFragmentsStore.prototype._removeRef = function(ref) { + var index = this._lookupByView.get(ref); + collection_1.MapWrapper.delete(this._lookupByView, ref); + collection_1.MapWrapper.delete(this._lookupByIndex, index); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderViewRef = function(viewRef) { + return this._serializeRenderFragmentOrViewRef(viewRef); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderFragmentRef = function(fragmentRef) { + return this._serializeRenderFragmentOrViewRef(fragmentRef); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderViewRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderFragmentRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype._retrieve = function(ref) { + if (ref == null) { + return null; + } + if (!this._lookupByIndex.has(ref)) { + return null; + } + return this._lookupByIndex.get(ref); + }; + RenderViewWithFragmentsStore.prototype._serializeRenderFragmentOrViewRef = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return ref.serialize(); + } else { + return this._lookupByView.get(ref); + } + }; + RenderViewWithFragmentsStore.prototype.serializeViewWithFragments = function(view) { + var _this = this; + if (view == null) { + return null; + } + if (this._onWebWorker) { + return { + 'viewRef': view.viewRef.serialize(), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return val.serialize(); + }) + }; + } else { + return { + 'viewRef': this._lookupByView.get(view.viewRef), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return _this._lookupByView.get(val); + }) + }; + } + }; + RenderViewWithFragmentsStore.prototype.deserializeViewWithFragments = function(obj) { + var _this = this; + if (obj == null) { + return null; + } + var viewRef = this.deserializeRenderViewRef(obj['viewRef']); + var fragments = collection_1.ListWrapper.map(obj['fragmentRefs'], function(val) { + return _this.deserializeRenderFragmentRef(val); + }); + return new api_1.RenderViewWithFragments(viewRef, fragments); + }; + RenderViewWithFragmentsStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderViewWithFragmentsStore); + return RenderViewWithFragmentsStore; + })(); + exports.RenderViewWithFragmentsStore = RenderViewWithFragmentsStore; + var WebWorkerRenderViewRef = (function(_super) { + __extends(WebWorkerRenderViewRef, _super); + function WebWorkerRenderViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderViewRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderViewRef.deserialize = function(ref) { + return new WebWorkerRenderViewRef(ref); + }; + return WebWorkerRenderViewRef; + })(api_1.RenderViewRef); + exports.WebWorkerRenderViewRef = WebWorkerRenderViewRef; + var WebWorkerRenderFragmentRef = (function(_super) { + __extends(WebWorkerRenderFragmentRef, _super); + function WebWorkerRenderFragmentRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderFragmentRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderFragmentRef.deserialize = function(ref) { + return new WebWorkerRenderFragmentRef(ref); + }; + return WebWorkerRenderFragmentRef; + })(api_1.RenderFragmentRef); + exports.WebWorkerRenderFragmentRef = WebWorkerRenderFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/anchor_based_app_root_url", ["angular2/src/core/services/app_root_url", "angular2/src/core/dom/dom_adapter", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var AnchorBasedAppRootUrl = (function(_super) { + __extends(AnchorBasedAppRootUrl, _super); + function AnchorBasedAppRootUrl() { + _super.call(this, ""); + var rootUrl; + var a = dom_adapter_1.DOM.createElement('a'); + dom_adapter_1.DOM.resolveAndSetHref(a, './', null); + rootUrl = dom_adapter_1.DOM.getHref(a); + this.value = rootUrl; + } + AnchorBasedAppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AnchorBasedAppRootUrl); + return AnchorBasedAppRootUrl; + })(app_root_url_1.AppRootUrl); + exports.AnchorBasedAppRootUrl = AnchorBasedAppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/message_bus", ["angular2/src/core/facade/exceptions", "angular2/src/core/facade/async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + exports.EventEmitter = async_1.EventEmitter; + exports.Observable = async_1.Observable; + function _abstract() { + throw new exceptions_1.BaseException("This method is abstract"); + } + var MessageBus = (function() { + function MessageBus() {} + MessageBus.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + throw _abstract(); + }; + MessageBus.prototype.attachToZone = function(zone) { + throw _abstract(); + }; + MessageBus.prototype.from = function(channel) { + throw _abstract(); + }; + MessageBus.prototype.to = function(channel) { + throw _abstract(); + }; + return MessageBus; + })(); + exports.MessageBus = MessageBus; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/messaging_api", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + exports.SETUP_CHANNEL = "ng-WebWorkerSetup"; + exports.RENDER_COMPILER_CHANNEL = "ng-RenderCompiler"; + exports.RENDERER_CHANNEL = "ng-Renderer"; + exports.XHR_CHANNEL = "ng-XHR"; + exports.EVENT_CHANNEL = "ng-events"; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/bind", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function bind(fn, scope) { + return fn.bind(scope); + } + exports.bind = bind; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/service_message_broker", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/web_workers/shared/serializer", "angular2/src/core/facade/lang", "angular2/src/web_workers/shared/message_bus", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var lang_1 = require("angular2/src/core/facade/lang"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var async_1 = require("angular2/src/core/facade/async"); + var ServiceMessageBrokerFactory = (function() { + function ServiceMessageBrokerFactory(_messageBus, _serializer) { + this._messageBus = _messageBus; + this._serializer = _serializer; + } + ServiceMessageBrokerFactory.prototype.createMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this._messageBus.initChannel(channel, runInZone); + return new ServiceMessageBroker(this._messageBus, this._serializer, channel); + }; + ServiceMessageBrokerFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, serializer_1.Serializer])], ServiceMessageBrokerFactory); + return ServiceMessageBrokerFactory; + })(); + exports.ServiceMessageBrokerFactory = ServiceMessageBrokerFactory; + var ServiceMessageBroker = (function() { + function ServiceMessageBroker(messageBus, _serializer, channel) { + var _this = this; + this._serializer = _serializer; + this.channel = channel; + this._methods = new collection_1.Map(); + this._sink = messageBus.to(channel); + var source = messageBus.from(channel); + async_1.ObservableWrapper.subscribe(source, function(message) { + return _this._handleMessage(message); + }); + } + ServiceMessageBroker.prototype.registerMethod = function(methodName, signature, method, returnType) { + var _this = this; + this._methods.set(methodName, function(message) { + var serializedArgs = message.args; + var deserializedArgs = collection_1.ListWrapper.createFixedSize(signature.length); + for (var i = 0; i < signature.length; i++) { + var serializedArg = serializedArgs[i]; + deserializedArgs[i] = _this._serializer.deserialize(serializedArg, signature[i]); + } + var promise = lang_1.FunctionWrapper.apply(method, deserializedArgs); + if (lang_1.isPresent(returnType) && lang_1.isPresent(promise)) { + _this._wrapWebWorkerPromise(message.id, promise, returnType); + } + }); + }; + ServiceMessageBroker.prototype._handleMessage = function(map) { + var message = new ReceivedMessage(map); + if (this._methods.has(message.method)) { + this._methods.get(message.method)(message); + } + }; + ServiceMessageBroker.prototype._wrapWebWorkerPromise = function(id, promise, type) { + var _this = this; + async_1.PromiseWrapper.then(promise, function(result) { + async_1.ObservableWrapper.callNext(_this._sink, { + 'type': 'result', + 'value': _this._serializer.serialize(result, type), + 'id': id + }); + }); + }; + return ServiceMessageBroker; + })(); + exports.ServiceMessageBroker = ServiceMessageBroker; + var ReceivedMessage = (function() { + function ReceivedMessage(data) { + this.method = data['method']; + this.args = data['args']; + this.id = data['id']; + this.type = data['type']; + } + return ReceivedMessage; + })(); + exports.ReceivedMessage = ReceivedMessage; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/event_serializer", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var MOUSE_EVENT_PROPERTIES = ["altKey", "button", "clientX", "clientY", "metaKey", "movementX", "movementY", "offsetX", "offsetY", "region", "screenX", "screenY", "shiftKey"]; + var KEYBOARD_EVENT_PROPERTIES = ['altkey', 'charCode', 'code', 'ctrlKey', 'isComposing', 'key', 'keyCode', 'location', 'metaKey', 'repeat', 'shiftKey', 'which']; + var EVENT_PROPERTIES = ['type', 'bubbles', 'cancelable']; + var NODES_WITH_VALUE = new collection_1.Set(["input", "select", "option", "button", "li", "meter", "progress", "param"]); + function serializeGenericEvent(e) { + return serializeEvent(e, EVENT_PROPERTIES); + } + exports.serializeGenericEvent = serializeGenericEvent; + function serializeEventWithTarget(e) { + var serializedEvent = serializeEvent(e, EVENT_PROPERTIES); + return addTarget(e, serializedEvent); + } + exports.serializeEventWithTarget = serializeEventWithTarget; + function serializeMouseEvent(e) { + return serializeEvent(e, MOUSE_EVENT_PROPERTIES); + } + exports.serializeMouseEvent = serializeMouseEvent; + function serializeKeyboardEvent(e) { + var serializedEvent = serializeEvent(e, KEYBOARD_EVENT_PROPERTIES); + return addTarget(e, serializedEvent); + } + exports.serializeKeyboardEvent = serializeKeyboardEvent; + function addTarget(e, serializedEvent) { + if (NODES_WITH_VALUE.has(e.target.tagName.toLowerCase())) { + var target = e.target; + serializedEvent['target'] = {'value': target.value}; + if (lang_1.isPresent(target.files)) { + serializedEvent['target']['files'] = target.files; + } + } + return serializedEvent; + } + function serializeEvent(e, properties) { + var serialized = {}; + for (var i = 0; i < properties.length; i++) { + var prop = properties[i]; + serialized[prop] = e[prop]; + } + return serialized; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/xhr_impl", ["angular2/src/core/di", "angular2/src/web_workers/shared/serializer", "angular2/src/web_workers/shared/messaging_api", "angular2/src/core/render/xhr", "angular2/src/web_workers/shared/service_message_broker", "angular2/src/web_workers/ui/bind"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var service_message_broker_1 = require("angular2/src/web_workers/shared/service_message_broker"); + var bind_1 = require("angular2/src/web_workers/ui/bind"); + var MessageBasedXHRImpl = (function() { + function MessageBasedXHRImpl(_brokerFactory, _xhr) { + this._brokerFactory = _brokerFactory; + this._xhr = _xhr; + } + MessageBasedXHRImpl.prototype.start = function() { + var broker = this._brokerFactory.createMessageBroker(messaging_api_1.XHR_CHANNEL); + broker.registerMethod("get", [serializer_1.PRIMITIVE], bind_1.bind(this._xhr.get, this._xhr), serializer_1.PRIMITIVE); + }; + MessageBasedXHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [service_message_broker_1.ServiceMessageBrokerFactory, xhr_1.XHR])], MessageBasedXHRImpl); + return MessageBasedXHRImpl; + })(); + exports.MessageBasedXHRImpl = MessageBasedXHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/setup", ["angular2/src/web_workers/shared/messaging_api", "angular2/src/core/facade/async", "angular2/src/web_workers/shared/message_bus", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/core/facade/lang", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var async_1 = require("angular2/src/core/facade/async"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var WebWorkerSetup = (function() { + function WebWorkerSetup(_bus, anchorBasedAppRootUrl) { + this._bus = _bus; + this.rootUrl = anchorBasedAppRootUrl.value; + } + WebWorkerSetup.prototype.start = function() { + var _this = this; + this._bus.initChannel(messaging_api_1.SETUP_CHANNEL, false); + var sink = this._bus.to(messaging_api_1.SETUP_CHANNEL); + var source = this._bus.from(messaging_api_1.SETUP_CHANNEL); + async_1.ObservableWrapper.subscribe(source, function(message) { + if (lang_1.StringWrapper.equals(message, "ready")) { + async_1.ObservableWrapper.callNext(sink, {"rootUrl": _this.rootUrl}); + } + }); + }; + WebWorkerSetup = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, anchor_based_app_root_url_1.AnchorBasedAppRootUrl])], WebWorkerSetup); + return WebWorkerSetup; + })(); + exports.WebWorkerSetup = WebWorkerSetup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/client_message_broker", ["angular2/src/web_workers/shared/message_bus", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/web_workers/shared/serializer", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var di_1 = require("angular2/src/core/di"); + var lang_2 = require("angular2/src/core/facade/lang"); + var lang_3 = require("angular2/src/core/facade/lang"); + exports.Type = lang_3.Type; + var ClientMessageBrokerFactory = (function() { + function ClientMessageBrokerFactory(_messageBus, _serializer) { + this._messageBus = _messageBus; + this._serializer = _serializer; + } + ClientMessageBrokerFactory.prototype.createMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this._messageBus.initChannel(channel, runInZone); + return new ClientMessageBroker(this._messageBus, this._serializer, channel); + }; + ClientMessageBrokerFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, serializer_1.Serializer])], ClientMessageBrokerFactory); + return ClientMessageBrokerFactory; + })(); + exports.ClientMessageBrokerFactory = ClientMessageBrokerFactory; + var ClientMessageBroker = (function() { + function ClientMessageBroker(messageBus, _serializer, channel) { + var _this = this; + this._serializer = _serializer; + this.channel = channel; + this._pending = new Map(); + this._sink = messageBus.to(channel); + var source = messageBus.from(channel); + async_1.ObservableWrapper.subscribe(source, function(message) { + return _this._handleMessage(message); + }); + } + ClientMessageBroker.prototype._generateMessageId = function(name) { + var time = lang_1.stringify(lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now())); + var iteration = 0; + var id = name + time + lang_1.stringify(iteration); + while (lang_1.isPresent(this._pending[id])) { + id = "" + name + time + iteration; + iteration++; + } + return id; + }; + ClientMessageBroker.prototype.runOnService = function(args, returnType) { + var _this = this; + var fnArgs = []; + if (lang_1.isPresent(args.args)) { + collection_1.ListWrapper.forEach(args.args, function(argument) { + if (argument.type != null) { + fnArgs.push(_this._serializer.serialize(argument.value, argument.type)); + } else { + fnArgs.push(argument.value); + } + }); + } + var promise; + var id = null; + if (returnType != null) { + var completer = async_1.PromiseWrapper.completer(); + id = this._generateMessageId(args.method); + this._pending.set(id, completer); + async_1.PromiseWrapper.catchError(completer.promise, function(err, stack) { + lang_1.print(err); + completer.reject(err, stack); + }); + promise = async_1.PromiseWrapper.then(completer.promise, function(value) { + if (_this._serializer == null) { + return value; + } else { + return _this._serializer.deserialize(value, returnType); + } + }); + } else { + promise = null; + } + var message = { + 'method': args.method, + 'args': fnArgs + }; + if (id != null) { + message['id'] = id; + } + async_1.ObservableWrapper.callNext(this._sink, message); + return promise; + }; + ClientMessageBroker.prototype._handleMessage = function(message) { + var data = new MessageData(message); + if (lang_2.StringWrapper.equals(data.type, "result") || lang_2.StringWrapper.equals(data.type, "error")) { + var id = data.id; + if (this._pending.has(id)) { + if (lang_2.StringWrapper.equals(data.type, "result")) { + this._pending.get(id).resolve(data.value); + } else { + this._pending.get(id).reject(data.value, null); + } + this._pending.delete(id); + } + } + }; + return ClientMessageBroker; + })(); + exports.ClientMessageBroker = ClientMessageBroker; + var MessageData = (function() { + function MessageData(data) { + this.type = collection_1.StringMapWrapper.get(data, "type"); + this.id = this._getValueIfPresent(data, "id"); + this.value = this._getValueIfPresent(data, "value"); + } + MessageData.prototype._getValueIfPresent = function(data, key) { + if (collection_1.StringMapWrapper.contains(data, key)) { + return collection_1.StringMapWrapper.get(data, key); + } else { + return null; + } + }; + return MessageData; + })(); + var FnArg = (function() { + function FnArg(value, type) { + this.value = value; + this.type = type; + } + return FnArg; + })(); + exports.FnArg = FnArg; + var UiArguments = (function() { + function UiArguments(method, args) { + this.method = method; + this.args = args; + } + return UiArguments; + })(); + exports.UiArguments = UiArguments; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_init", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function wtfInit() {} + exports.wtfInit = wtfInit; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/browser_adapter", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/dom/generic_browser_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var generic_browser_adapter_1 = require("angular2/src/core/dom/generic_browser_adapter"); + var _attrToPropMap = { + 'class': 'className', + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex' + }; + var DOM_KEY_LOCATION_NUMPAD = 3; + var _keyMap = { + '\b': 'Backspace', + '\t': 'Tab', + '\x7F': 'Delete', + '\x1B': 'Escape', + 'Del': 'Delete', + 'Esc': 'Escape', + 'Left': 'ArrowLeft', + 'Right': 'ArrowRight', + 'Up': 'ArrowUp', + 'Down': 'ArrowDown', + 'Menu': 'ContextMenu', + 'Scroll': 'ScrollLock', + 'Win': 'OS' + }; + var _chromeNumKeyPadMap = { + 'A': '1', + 'B': '2', + 'C': '3', + 'D': '4', + 'E': '5', + 'F': '6', + 'G': '7', + 'H': '8', + 'I': '9', + 'J': '*', + 'K': '+', + 'M': '-', + 'N': '.', + 'O': '/', + '\x60': '0', + '\x90': 'NumLock' + }; + var BrowserDomAdapter = (function(_super) { + __extends(BrowserDomAdapter, _super); + function BrowserDomAdapter() { + _super.apply(this, arguments); + } + BrowserDomAdapter.makeCurrent = function() { + dom_adapter_1.setRootDomAdapter(new BrowserDomAdapter()); + }; + BrowserDomAdapter.prototype.hasProperty = function(element, name) { + return name in element; + }; + BrowserDomAdapter.prototype.setProperty = function(el, name, value) { + el[name] = value; + }; + BrowserDomAdapter.prototype.getProperty = function(el, name) { + return el[name]; + }; + BrowserDomAdapter.prototype.invoke = function(el, methodName, args) { + el[methodName].apply(el, args); + }; + BrowserDomAdapter.prototype.logError = function(error) { + if (window.console.error) { + window.console.error(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.log = function(error) { + window.console.log(error); + }; + BrowserDomAdapter.prototype.logGroup = function(error) { + if (window.console.group) { + window.console.group(error); + this.logError(error); + } else { + window.console.log(error); + } + }; + BrowserDomAdapter.prototype.logGroupEnd = function() { + if (window.console.groupEnd) { + window.console.groupEnd(); + } + }; + Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { + get: function() { + return _attrToPropMap; + }, + enumerable: true, + configurable: true + }); + BrowserDomAdapter.prototype.query = function(selector) { + return document.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelector = function(el, selector) { + return el.querySelector(selector); + }; + BrowserDomAdapter.prototype.querySelectorAll = function(el, selector) { + return el.querySelectorAll(selector); + }; + BrowserDomAdapter.prototype.on = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + }; + BrowserDomAdapter.prototype.onAndCancel = function(el, evt, listener) { + el.addEventListener(evt, listener, false); + return function() { + el.removeEventListener(evt, listener, false); + }; + }; + BrowserDomAdapter.prototype.dispatchEvent = function(el, evt) { + el.dispatchEvent(evt); + }; + BrowserDomAdapter.prototype.createMouseEvent = function(eventType) { + var evt = document.createEvent('MouseEvent'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.createEvent = function(eventType) { + var evt = document.createEvent('Event'); + evt.initEvent(eventType, true, true); + return evt; + }; + BrowserDomAdapter.prototype.preventDefault = function(evt) { + evt.preventDefault(); + evt.returnValue = false; + }; + BrowserDomAdapter.prototype.isPrevented = function(evt) { + return evt.defaultPrevented || lang_1.isPresent(evt.returnValue) && !evt.returnValue; + }; + BrowserDomAdapter.prototype.getInnerHTML = function(el) { + return el.innerHTML; + }; + BrowserDomAdapter.prototype.getOuterHTML = function(el) { + return el.outerHTML; + }; + BrowserDomAdapter.prototype.nodeName = function(node) { + return node.nodeName; + }; + BrowserDomAdapter.prototype.nodeValue = function(node) { + return node.nodeValue; + }; + BrowserDomAdapter.prototype.type = function(node) { + return node.type; + }; + BrowserDomAdapter.prototype.content = function(node) { + if (this.hasProperty(node, "content")) { + return node.content; + } else { + return node; + } + }; + BrowserDomAdapter.prototype.firstChild = function(el) { + return el.firstChild; + }; + BrowserDomAdapter.prototype.nextSibling = function(el) { + return el.nextSibling; + }; + BrowserDomAdapter.prototype.parentElement = function(el) { + return el.parentNode; + }; + BrowserDomAdapter.prototype.childNodes = function(el) { + return el.childNodes; + }; + BrowserDomAdapter.prototype.childNodesAsList = function(el) { + var childNodes = el.childNodes; + var res = collection_1.ListWrapper.createFixedSize(childNodes.length); + for (var i = 0; i < childNodes.length; i++) { + res[i] = childNodes[i]; + } + return res; + }; + BrowserDomAdapter.prototype.clearNodes = function(el) { + while (el.firstChild) { + el.removeChild(el.firstChild); + } + }; + BrowserDomAdapter.prototype.appendChild = function(el, node) { + el.appendChild(node); + }; + BrowserDomAdapter.prototype.removeChild = function(el, node) { + el.removeChild(node); + }; + BrowserDomAdapter.prototype.replaceChild = function(el, newChild, oldChild) { + el.replaceChild(newChild, oldChild); + }; + BrowserDomAdapter.prototype.remove = function(node) { + node.parentNode.removeChild(node); + return node; + }; + BrowserDomAdapter.prototype.insertBefore = function(el, node) { + el.parentNode.insertBefore(node, el); + }; + BrowserDomAdapter.prototype.insertAllBefore = function(el, nodes) { + collection_1.ListWrapper.forEach(nodes, function(n) { + el.parentNode.insertBefore(n, el); + }); + }; + BrowserDomAdapter.prototype.insertAfter = function(el, node) { + el.parentNode.insertBefore(node, el.nextSibling); + }; + BrowserDomAdapter.prototype.setInnerHTML = function(el, value) { + el.innerHTML = value; + }; + BrowserDomAdapter.prototype.getText = function(el) { + return el.textContent; + }; + BrowserDomAdapter.prototype.setText = function(el, value) { + el.textContent = value; + }; + BrowserDomAdapter.prototype.getValue = function(el) { + return el.value; + }; + BrowserDomAdapter.prototype.setValue = function(el, value) { + el.value = value; + }; + BrowserDomAdapter.prototype.getChecked = function(el) { + return el.checked; + }; + BrowserDomAdapter.prototype.setChecked = function(el, value) { + el.checked = value; + }; + BrowserDomAdapter.prototype.createComment = function(text) { + return document.createComment(text); + }; + BrowserDomAdapter.prototype.createTemplate = function(html) { + var t = document.createElement('template'); + t.innerHTML = html; + return t; + }; + BrowserDomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createElement(tagName); + }; + BrowserDomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = document; + } + return doc.createTextNode(text); + }; + BrowserDomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = document; + } + var el = doc.createElement('SCRIPT'); + el.setAttribute(attrName, attrValue); + return el; + }; + BrowserDomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = document; + } + var style = doc.createElement('style'); + this.appendChild(style, this.createTextNode(css)); + return style; + }; + BrowserDomAdapter.prototype.createShadowRoot = function(el) { + return el.createShadowRoot(); + }; + BrowserDomAdapter.prototype.getShadowRoot = function(el) { + return el.shadowRoot; + }; + BrowserDomAdapter.prototype.getHost = function(el) { + return el.host; + }; + BrowserDomAdapter.prototype.clone = function(node) { + return node.cloneNode(true); + }; + BrowserDomAdapter.prototype.getElementsByClassName = function(element, name) { + return element.getElementsByClassName(name); + }; + BrowserDomAdapter.prototype.getElementsByTagName = function(element, name) { + return element.getElementsByTagName(name); + }; + BrowserDomAdapter.prototype.classList = function(element) { + return Array.prototype.slice.call(element.classList, 0); + }; + BrowserDomAdapter.prototype.addClass = function(element, classname) { + element.classList.add(classname); + }; + BrowserDomAdapter.prototype.removeClass = function(element, classname) { + element.classList.remove(classname); + }; + BrowserDomAdapter.prototype.hasClass = function(element, classname) { + return element.classList.contains(classname); + }; + BrowserDomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + element.style[stylename] = stylevalue; + }; + BrowserDomAdapter.prototype.removeStyle = function(element, stylename) { + element.style[stylename] = null; + }; + BrowserDomAdapter.prototype.getStyle = function(element, stylename) { + return element.style[stylename]; + }; + BrowserDomAdapter.prototype.tagName = function(element) { + return element.tagName; + }; + BrowserDomAdapter.prototype.attributeMap = function(element) { + var res = new Map(); + var elAttrs = element.attributes; + for (var i = 0; i < elAttrs.length; i++) { + var attrib = elAttrs[i]; + res.set(attrib.name, attrib.value); + } + return res; + }; + BrowserDomAdapter.prototype.hasAttribute = function(element, attribute) { + return element.hasAttribute(attribute); + }; + BrowserDomAdapter.prototype.getAttribute = function(element, attribute) { + return element.getAttribute(attribute); + }; + BrowserDomAdapter.prototype.setAttribute = function(element, name, value) { + element.setAttribute(name, value); + }; + BrowserDomAdapter.prototype.removeAttribute = function(element, attribute) { + element.removeAttribute(attribute); + }; + BrowserDomAdapter.prototype.templateAwareRoot = function(el) { + return this.isTemplateElement(el) ? this.content(el) : el; + }; + BrowserDomAdapter.prototype.createHtmlDocument = function() { + return document.implementation.createHTMLDocument('fakeTitle'); + }; + BrowserDomAdapter.prototype.defaultDoc = function() { + return document; + }; + BrowserDomAdapter.prototype.getBoundingClientRect = function(el) { + try { + return el.getBoundingClientRect(); + } catch (e) { + return { + top: 0, + bottom: 0, + left: 0, + right: 0, + width: 0, + height: 0 + }; + } + }; + BrowserDomAdapter.prototype.getTitle = function() { + return document.title; + }; + BrowserDomAdapter.prototype.setTitle = function(newTitle) { + document.title = newTitle || ''; + }; + BrowserDomAdapter.prototype.elementMatches = function(n, selector) { + var matches = false; + if (n instanceof HTMLElement) { + if (n.matches) { + matches = n.matches(selector); + } else if (n.msMatchesSelector) { + matches = n.msMatchesSelector(selector); + } else if (n.webkitMatchesSelector) { + matches = n.webkitMatchesSelector(selector); + } + } + return matches; + }; + BrowserDomAdapter.prototype.isTemplateElement = function(el) { + return el instanceof HTMLElement && el.nodeName == "TEMPLATE"; + }; + BrowserDomAdapter.prototype.isTextNode = function(node) { + return node.nodeType === Node.TEXT_NODE; + }; + BrowserDomAdapter.prototype.isCommentNode = function(node) { + return node.nodeType === Node.COMMENT_NODE; + }; + BrowserDomAdapter.prototype.isElementNode = function(node) { + return node.nodeType === Node.ELEMENT_NODE; + }; + BrowserDomAdapter.prototype.hasShadowRoot = function(node) { + return node instanceof HTMLElement && lang_1.isPresent(node.shadowRoot); + }; + BrowserDomAdapter.prototype.isShadowRoot = function(node) { + return node instanceof DocumentFragment; + }; + BrowserDomAdapter.prototype.importIntoDoc = function(node) { + var toImport = node; + if (this.isTemplateElement(node)) { + toImport = this.content(node); + } + return document.importNode(toImport, true); + }; + BrowserDomAdapter.prototype.adoptNode = function(node) { + return document.adoptNode(node); + }; + BrowserDomAdapter.prototype.isPageRule = function(rule) { + return rule.type === CSSRule.PAGE_RULE; + }; + BrowserDomAdapter.prototype.isStyleRule = function(rule) { + return rule.type === CSSRule.STYLE_RULE; + }; + BrowserDomAdapter.prototype.isMediaRule = function(rule) { + return rule.type === CSSRule.MEDIA_RULE; + }; + BrowserDomAdapter.prototype.isKeyframesRule = function(rule) { + return rule.type === CSSRule.KEYFRAMES_RULE; + }; + BrowserDomAdapter.prototype.getHref = function(el) { + return el.href; + }; + BrowserDomAdapter.prototype.getEventKey = function(event) { + var key = event.key; + if (lang_1.isBlank(key)) { + key = event.keyIdentifier; + if (lang_1.isBlank(key)) { + return 'Unidentified'; + } + if (key.startsWith('U+')) { + key = String.fromCharCode(parseInt(key.substring(2), 16)); + if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { + key = _chromeNumKeyPadMap[key]; + } + } + } + if (_keyMap.hasOwnProperty(key)) { + key = _keyMap[key]; + } + return key; + }; + BrowserDomAdapter.prototype.getGlobalEventTarget = function(target) { + if (target == "window") { + return window; + } else if (target == "document") { + return document; + } else if (target == "body") { + return document.body; + } + }; + BrowserDomAdapter.prototype.getHistory = function() { + return window.history; + }; + BrowserDomAdapter.prototype.getLocation = function() { + return window.location; + }; + BrowserDomAdapter.prototype.getBaseHref = function() { + var href = getBaseElementHref(); + if (lang_1.isBlank(href)) { + return null; + } + return relativePath(href); + }; + BrowserDomAdapter.prototype.resetBaseElement = function() { + baseElement = null; + }; + BrowserDomAdapter.prototype.getUserAgent = function() { + return window.navigator.userAgent; + }; + BrowserDomAdapter.prototype.setData = function(element, name, value) { + this.setAttribute(element, 'data-' + name, value); + }; + BrowserDomAdapter.prototype.getData = function(element, name) { + return this.getAttribute(element, 'data-' + name); + }; + BrowserDomAdapter.prototype.getComputedStyle = function(element) { + return getComputedStyle(element); + }; + BrowserDomAdapter.prototype.setGlobalVar = function(path, value) { + lang_1.setValueOnPath(lang_1.global, path, value); + }; + BrowserDomAdapter.prototype.requestAnimationFrame = function(callback) { + return window.requestAnimationFrame(callback); + }; + BrowserDomAdapter.prototype.cancelAnimationFrame = function(id) { + window.cancelAnimationFrame(id); + }; + BrowserDomAdapter.prototype.performanceNow = function() { + if (lang_1.isPresent(window.performance) && lang_1.isPresent(window.performance.now)) { + return window.performance.now(); + } else { + return lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + } + }; + return BrowserDomAdapter; + })(generic_browser_adapter_1.GenericBrowserDomAdapter); + exports.BrowserDomAdapter = BrowserDomAdapter; + var baseElement = null; + function getBaseElementHref() { + if (lang_1.isBlank(baseElement)) { + baseElement = document.querySelector('base'); + if (lang_1.isBlank(baseElement)) { + return null; + } + } + return baseElement.getAttribute('href'); + } + var urlParsingNode = null; + function relativePath(url) { + if (lang_1.isBlank(urlParsingNode)) { + urlParsingNode = document.createElement("a"); + } + urlParsingNode.setAttribute('href', url); + return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/events/hammer_gestures", ["angular2/src/core/render/dom/events/hammer_common", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var hammer_common_1 = require("angular2/src/core/render/dom/events/hammer_common"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var di_1 = require("angular2/src/core/di"); + var HammerGesturesPlugin = (function(_super) { + __extends(HammerGesturesPlugin, _super); + function HammerGesturesPlugin() { + _super.apply(this, arguments); + } + HammerGesturesPlugin.prototype.supports = function(eventName) { + if (!_super.prototype.supports.call(this, eventName)) + return false; + if (!lang_1.isPresent(window['Hammer'])) { + throw new exceptions_1.BaseException("Hammer.js is not loaded, can not bind " + eventName + " event"); + } + return true; + }; + HammerGesturesPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + eventName = eventName.toLowerCase(); + zone.runOutsideAngular(function() { + var mc = new Hammer(element); + mc.get('pinch').set({enable: true}); + mc.get('rotate').set({enable: true}); + mc.on(eventName, function(eventObj) { + zone.run(function() { + handler(eventObj); + }); + }); + }); + }; + HammerGesturesPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HammerGesturesPlugin); + return HammerGesturesPlugin; + })(hammer_common_1.HammerGesturesPluginCommon); + exports.HammerGesturesPlugin = HammerGesturesPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/serializer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/di", "angular2/src/web_workers/shared/render_proto_view_ref_store", "angular2/src/web_workers/shared/render_view_with_fragments_store"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + var di_1 = require("angular2/src/core/di"); + var render_proto_view_ref_store_1 = require("angular2/src/web_workers/shared/render_proto_view_ref_store"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + exports.PRIMITIVE = String; + var Serializer = (function() { + function Serializer(_parser, _protoViewStore, _renderViewStore) { + this._parser = _parser; + this._protoViewStore = _protoViewStore; + this._renderViewStore = _renderViewStore; + this._enumRegistry = new collection_1.Map(); + var viewTypeMap = new collection_1.Map(); + viewTypeMap[0] = api_1.ViewType.HOST; + viewTypeMap[1] = api_1.ViewType.COMPONENT; + viewTypeMap[2] = api_1.ViewType.EMBEDDED; + this._enumRegistry.set(api_1.ViewType, viewTypeMap); + var viewEncapsulationMap = new collection_1.Map(); + viewEncapsulationMap[0] = api_1.ViewEncapsulation.Emulated; + viewEncapsulationMap[1] = api_1.ViewEncapsulation.Native; + viewEncapsulationMap[2] = api_1.ViewEncapsulation.None; + this._enumRegistry.set(api_1.ViewEncapsulation, viewEncapsulationMap); + var propertyBindingTypeMap = new collection_1.Map(); + propertyBindingTypeMap[0] = api_1.PropertyBindingType.PROPERTY; + propertyBindingTypeMap[1] = api_1.PropertyBindingType.ATTRIBUTE; + propertyBindingTypeMap[2] = api_1.PropertyBindingType.CLASS; + propertyBindingTypeMap[3] = api_1.PropertyBindingType.STYLE; + this._enumRegistry.set(api_1.PropertyBindingType, propertyBindingTypeMap); + } + Serializer.prototype.serialize = function(obj, type) { + var _this = this; + if (!lang_1.isPresent(obj)) { + return null; + } + if (lang_1.isArray(obj)) { + var serializedObj = []; + collection_1.ListWrapper.forEach(obj, function(val) { + serializedObj.push(_this.serialize(val, type)); + }); + return serializedObj; + } + if (type == exports.PRIMITIVE) { + return obj; + } + if (type == api_1.ViewDefinition) { + return this._serializeViewDefinition(obj); + } else if (type == api_1.DirectiveBinder) { + return this._serializeDirectiveBinder(obj); + } else if (type == api_1.ProtoViewDto) { + return this._serializeProtoViewDto(obj); + } else if (type == api_1.RenderElementBinder) { + return this._serializeElementBinder(obj); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._serializeDirectiveMetadata(obj); + } else if (type == change_detection_1.ASTWithSource) { + return this._serializeASTWithSource(obj); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.serialize(obj); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._serializeRenderProtoViewMergeMapping(obj); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.serializeRenderViewRef(obj); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.serializeRenderFragmentRef(obj); + } else if (type == api_2.WebWorkerElementRef) { + return this._serializeWorkerElementRef(obj); + } else if (type == api_1.ElementPropertyBinding) { + return this._serializeElementPropertyBinding(obj); + } else if (type == api_1.EventBinding) { + return this._serializeEventBinding(obj); + } else { + throw new exceptions_1.BaseException("No serializer for " + type.toString()); + } + }; + Serializer.prototype.deserialize = function(map, type, data) { + var _this = this; + if (!lang_1.isPresent(map)) { + return null; + } + if (lang_1.isArray(map)) { + var obj = []; + collection_1.ListWrapper.forEach(map, function(val) { + obj.push(_this.deserialize(val, type, data)); + }); + return obj; + } + if (type == exports.PRIMITIVE) { + return map; + } + if (type == api_1.ViewDefinition) { + return this._deserializeViewDefinition(map); + } else if (type == api_1.DirectiveBinder) { + return this._deserializeDirectiveBinder(map); + } else if (type == api_1.ProtoViewDto) { + return this._deserializeProtoViewDto(map); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._deserializeDirectiveMetadata(map); + } else if (type == api_1.RenderElementBinder) { + return this._deserializeElementBinder(map); + } else if (type == change_detection_1.ASTWithSource) { + return this._deserializeASTWithSource(map, data); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.deserialize(map); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._deserializeRenderProtoViewMergeMapping(map); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.deserializeRenderViewRef(map); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.deserializeRenderFragmentRef(map); + } else if (type == api_2.WebWorkerElementRef) { + return this._deserializeWorkerElementRef(map); + } else if (type == api_1.EventBinding) { + return this._deserializeEventBinding(map); + } else if (type == api_1.ElementPropertyBinding) { + return this._deserializeElementPropertyBinding(map); + } else { + throw new exceptions_1.BaseException("No deserializer for " + type.toString()); + } + }; + Serializer.prototype.mapToObject = function(map, type) { + var _this = this; + var object = {}; + var serialize = lang_1.isPresent(type); + collection_1.MapWrapper.forEach(map, function(value, key) { + if (serialize) { + object[key] = _this.serialize(value, type); + } else { + object[key] = value; + } + }); + return object; + }; + Serializer.prototype.objectToMap = function(obj, type, data) { + var _this = this; + if (lang_1.isPresent(type)) { + var map = new collection_1.Map(); + collection_1.StringMapWrapper.forEach(obj, function(val, key) { + map.set(key, _this.deserialize(val, type, data)); + }); + return map; + } else { + return collection_1.MapWrapper.createFromStringMap(obj); + } + }; + Serializer.prototype.allocateRenderViews = function(fragmentCount) { + this._renderViewStore.allocate(fragmentCount); + }; + Serializer.prototype._serializeElementPropertyBinding = function(binding) { + return { + 'type': lang_1.serializeEnum(binding.type), + 'astWithSource': this.serialize(binding.astWithSource, change_detection_1.ASTWithSource), + 'property': binding.property, + 'unit': binding.unit + }; + }; + Serializer.prototype._deserializeElementPropertyBinding = function(map) { + var type = lang_1.deserializeEnum(map['type'], this._enumRegistry.get(api_1.PropertyBindingType)); + var ast = this.deserialize(map['astWithSource'], change_detection_1.ASTWithSource, "binding"); + return new api_1.ElementPropertyBinding(type, ast, map['property'], map['unit']); + }; + Serializer.prototype._serializeEventBinding = function(binding) { + return { + 'fullName': binding.fullName, + 'source': this.serialize(binding.source, change_detection_1.ASTWithSource) + }; + }; + Serializer.prototype._deserializeEventBinding = function(map) { + return new api_1.EventBinding(map['fullName'], this.deserialize(map['source'], change_detection_1.ASTWithSource, "action")); + }; + Serializer.prototype._serializeWorkerElementRef = function(elementRef) { + return { + 'renderView': this.serialize(elementRef.renderView, api_1.RenderViewRef), + 'renderBoundElementIndex': elementRef.renderBoundElementIndex + }; + }; + Serializer.prototype._deserializeWorkerElementRef = function(map) { + return new api_2.WebWorkerElementRef(this.deserialize(map['renderView'], api_1.RenderViewRef), map['renderBoundElementIndex']); + }; + Serializer.prototype._serializeRenderProtoViewMergeMapping = function(mapping) { + return { + 'mergedProtoViewRef': this._protoViewStore.serialize(mapping.mergedProtoViewRef), + 'fragmentCount': mapping.fragmentCount, + 'mappedElementIndices': mapping.mappedElementIndices, + 'mappedElementCount': mapping.mappedElementCount, + 'mappedTextIndices': mapping.mappedTextIndices, + 'hostElementIndicesByViewIndex': mapping.hostElementIndicesByViewIndex, + 'nestedViewCountByViewIndex': mapping.nestedViewCountByViewIndex + }; + }; + Serializer.prototype._deserializeRenderProtoViewMergeMapping = function(obj) { + return new api_1.RenderProtoViewMergeMapping(this._protoViewStore.deserialize(obj['mergedProtoViewRef']), obj['fragmentCount'], obj['mappedElementIndices'], obj['mappedElementCount'], obj['mappedTextIndices'], obj['hostElementIndicesByViewIndex'], obj['nestedViewCountByViewIndex']); + }; + Serializer.prototype._serializeASTWithSource = function(tree) { + return { + 'input': tree.source, + 'location': tree.location + }; + }; + Serializer.prototype._deserializeASTWithSource = function(obj, data) { + var ast; + switch (data) { + case "action": + ast = this._parser.parseAction(obj['input'], obj['location']); + break; + case "binding": + ast = this._parser.parseBinding(obj['input'], obj['location']); + break; + case "interpolation": + ast = this._parser.parseInterpolation(obj['input'], obj['location']); + break; + default: + throw "No AST deserializer for " + data; + } + return ast; + }; + Serializer.prototype._serializeViewDefinition = function(view) { + return { + 'componentId': view.componentId, + 'templateAbsUrl': view.templateAbsUrl, + 'template': view.template, + 'directives': this.serialize(view.directives, api_1.RenderDirectiveMetadata), + 'styleAbsUrls': view.styleAbsUrls, + 'styles': view.styles, + 'encapsulation': lang_1.serializeEnum(view.encapsulation) + }; + }; + Serializer.prototype._deserializeViewDefinition = function(obj) { + return new api_1.ViewDefinition({ + componentId: obj['componentId'], + templateAbsUrl: obj['templateAbsUrl'], + template: obj['template'], + directives: this.deserialize(obj['directives'], api_1.RenderDirectiveMetadata), + styleAbsUrls: obj['styleAbsUrls'], + styles: obj['styles'], + encapsulation: lang_1.deserializeEnum(obj['encapsulation'], this._enumRegistry.get(api_1.ViewEncapsulation)) + }); + }; + Serializer.prototype._serializeDirectiveBinder = function(binder) { + return { + 'directiveIndex': binder.directiveIndex, + 'propertyBindings': this.mapToObject(binder.propertyBindings, change_detection_1.ASTWithSource), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'hostPropertyBindings': this.serialize(binder.hostPropertyBindings, api_1.ElementPropertyBinding) + }; + }; + Serializer.prototype._deserializeDirectiveBinder = function(obj) { + return new api_1.DirectiveBinder({ + directiveIndex: obj['directiveIndex'], + propertyBindings: this.objectToMap(obj['propertyBindings'], change_detection_1.ASTWithSource, "binding"), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + hostPropertyBindings: this.deserialize(obj['hostPropertyBindings'], api_1.ElementPropertyBinding) + }); + }; + Serializer.prototype._serializeElementBinder = function(binder) { + return { + 'index': binder.index, + 'parentIndex': binder.parentIndex, + 'distanceToParent': binder.distanceToParent, + 'directives': this.serialize(binder.directives, api_1.DirectiveBinder), + 'nestedProtoView': this.serialize(binder.nestedProtoView, api_1.ProtoViewDto), + 'propertyBindings': this.serialize(binder.propertyBindings, api_1.ElementPropertyBinding), + 'variableBindings': this.mapToObject(binder.variableBindings), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'readAttributes': this.mapToObject(binder.readAttributes) + }; + }; + Serializer.prototype._deserializeElementBinder = function(obj) { + return new api_1.RenderElementBinder({ + index: obj['index'], + parentIndex: obj['parentIndex'], + distanceToParent: obj['distanceToParent'], + directives: this.deserialize(obj['directives'], api_1.DirectiveBinder), + nestedProtoView: this.deserialize(obj['nestedProtoView'], api_1.ProtoViewDto), + propertyBindings: this.deserialize(obj['propertyBindings'], api_1.ElementPropertyBinding), + variableBindings: this.objectToMap(obj['variableBindings']), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + readAttributes: this.objectToMap(obj['readAttributes']) + }); + }; + Serializer.prototype._serializeProtoViewDto = function(view) { + return { + 'render': this._protoViewStore.serialize(view.render), + 'elementBinders': this.serialize(view.elementBinders, api_1.RenderElementBinder), + 'variableBindings': this.mapToObject(view.variableBindings), + 'type': lang_1.serializeEnum(view.type), + 'textBindings': this.serialize(view.textBindings, change_detection_1.ASTWithSource), + 'transitiveNgContentCount': view.transitiveNgContentCount + }; + }; + Serializer.prototype._deserializeProtoViewDto = function(obj) { + return new api_1.ProtoViewDto({ + render: this._protoViewStore.deserialize(obj["render"]), + elementBinders: this.deserialize(obj['elementBinders'], api_1.RenderElementBinder), + variableBindings: this.objectToMap(obj['variableBindings']), + textBindings: this.deserialize(obj['textBindings'], change_detection_1.ASTWithSource, "interpolation"), + type: lang_1.deserializeEnum(obj['type'], this._enumRegistry.get(api_1.ViewType)), + transitiveNgContentCount: obj['transitiveNgContentCount'] + }); + }; + Serializer.prototype._serializeDirectiveMetadata = function(meta) { + var obj = { + 'id': meta.id, + 'selector': meta.selector, + 'compileChildren': meta.compileChildren, + 'events': meta.events, + 'properties': meta.properties, + 'readAttributes': meta.readAttributes, + 'type': meta.type, + 'callOnDestroy': meta.callOnDestroy, + 'callOnChanges': meta.callOnChanges, + 'callDoCheck': meta.callDoCheck, + 'callOnInit': meta.callOnInit, + 'callAfterContentChecked': meta.callAfterContentChecked, + 'changeDetection': meta.changeDetection, + 'exportAs': meta.exportAs, + 'hostProperties': this.mapToObject(meta.hostProperties), + 'hostListeners': this.mapToObject(meta.hostListeners), + 'hostAttributes': this.mapToObject(meta.hostAttributes) + }; + return obj; + }; + Serializer.prototype._deserializeDirectiveMetadata = function(obj) { + return new api_1.RenderDirectiveMetadata({ + id: obj['id'], + selector: obj['selector'], + compileChildren: obj['compileChildren'], + hostProperties: this.objectToMap(obj['hostProperties']), + hostListeners: this.objectToMap(obj['hostListeners']), + hostAttributes: this.objectToMap(obj['hostAttributes']), + properties: obj['properties'], + readAttributes: obj['readAttributes'], + type: obj['type'], + exportAs: obj['exportAs'], + callOnDestroy: obj['callOnDestroy'], + callOnChanges: obj['callOnChanges'], + callDoCheck: obj['callDoCheck'], + callOnInit: obj['callOnInit'], + callAfterContentChecked: obj['callAfterContentChecked'], + changeDetection: obj['changeDetection'], + events: obj['events'] + }); + }; + Serializer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [parser_1.Parser, render_proto_view_ref_store_1.RenderProtoViewRefStore, render_view_with_fragments_store_1.RenderViewWithFragmentsStore])], Serializer); + return Serializer; + })(); + exports.Serializer = Serializer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/render_compiler", ["angular2/src/core/di/decorators", "angular2/src/core/render/api", "angular2/src/web_workers/shared/messaging_api", "angular2/src/web_workers/ui/bind", "angular2/src/web_workers/shared/service_message_broker"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var api_1 = require("angular2/src/core/render/api"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var bind_1 = require("angular2/src/web_workers/ui/bind"); + var service_message_broker_1 = require("angular2/src/web_workers/shared/service_message_broker"); + var MessageBasedRenderCompiler = (function() { + function MessageBasedRenderCompiler(_brokerFactory, _renderCompiler) { + this._brokerFactory = _brokerFactory; + this._renderCompiler = _renderCompiler; + } + MessageBasedRenderCompiler.prototype.start = function() { + var broker = this._brokerFactory.createMessageBroker(messaging_api_1.RENDER_COMPILER_CHANNEL, false); + broker.registerMethod("compileHost", [api_1.RenderDirectiveMetadata], bind_1.bind(this._renderCompiler.compileHost, this._renderCompiler), api_1.ProtoViewDto); + broker.registerMethod("compile", [api_1.ViewDefinition], bind_1.bind(this._renderCompiler.compile, this._renderCompiler), api_1.ProtoViewDto); + broker.registerMethod("mergeProtoViewsRecursively", [api_1.RenderProtoViewRef], bind_1.bind(this._renderCompiler.mergeProtoViewsRecursively, this._renderCompiler), api_1.RenderProtoViewMergeMapping); + }; + MessageBasedRenderCompiler = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [service_message_broker_1.ServiceMessageBrokerFactory, api_1.RenderCompiler])], MessageBasedRenderCompiler); + return MessageBasedRenderCompiler; + })(); + exports.MessageBasedRenderCompiler = MessageBasedRenderCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/event_dispatcher", ["angular2/src/core/render/api", "angular2/src/web_workers/ui/event_serializer", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var event_serializer_1 = require("angular2/src/web_workers/ui/event_serializer"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var EventDispatcher = (function() { + function EventDispatcher(_viewRef, _sink, _serializer) { + this._viewRef = _viewRef; + this._sink = _sink; + this._serializer = _serializer; + } + EventDispatcher.prototype.dispatchRenderEvent = function(elementIndex, eventName, locals) { + var e = locals.get('$event'); + var serializedEvent; + switch (e.type) { + case "click": + case "mouseup": + case "mousedown": + case "dblclick": + case "contextmenu": + case "mouseenter": + case "mouseleave": + case "mousemove": + case "mouseout": + case "mouseover": + case "show": + serializedEvent = event_serializer_1.serializeMouseEvent(e); + break; + case "keydown": + case "keypress": + case "keyup": + serializedEvent = event_serializer_1.serializeKeyboardEvent(e); + break; + case "input": + case "change": + case "blur": + serializedEvent = event_serializer_1.serializeEventWithTarget(e); + break; + case "abort": + case "afterprint": + case "beforeprint": + case "cached": + case "canplay": + case "canplaythrough": + case "chargingchange": + case "chargingtimechange": + case "close": + case "dischargingtimechange": + case "DOMContentLoaded": + case "downloading": + case "durationchange": + case "emptied": + case "ended": + case "error": + case "fullscreenchange": + case "fullscreenerror": + case "invalid": + case "languagechange": + case "levelfchange": + case "loadeddata": + case "loadedmetadata": + case "obsolete": + case "offline": + case "online": + case "open": + case "orientatoinchange": + case "pause": + case "pointerlockchange": + case "pointerlockerror": + case "play": + case "playing": + case "ratechange": + case "readystatechange": + case "reset": + case "seeked": + case "seeking": + case "stalled": + case "submit": + case "success": + case "suspend": + case "timeupdate": + case "updateready": + case "visibilitychange": + case "volumechange": + case "waiting": + serializedEvent = event_serializer_1.serializeGenericEvent(e); + break; + default: + throw new exceptions_1.BaseException(eventName + " not supported on WebWorkers"); + } + var serializedLocals = collection_1.StringMapWrapper.create(); + collection_1.StringMapWrapper.set(serializedLocals, '$event', serializedEvent); + async_1.ObservableWrapper.callNext(this._sink, { + "viewRef": this._serializer.serialize(this._viewRef, api_1.RenderViewRef), + "elementIndex": elementIndex, + "eventName": eventName, + "locals": serializedLocals + }); + return false; + }; + return EventDispatcher; + })(); + exports.EventDispatcher = EventDispatcher; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/renderer", ["angular2/src/core/di", "angular2/src/web_workers/shared/message_bus", "angular2/src/web_workers/shared/serializer", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/web_workers/shared/messaging_api", "angular2/src/web_workers/ui/bind", "angular2/src/web_workers/ui/event_dispatcher", "angular2/src/web_workers/shared/render_view_with_fragments_store", "angular2/src/web_workers/shared/service_message_broker"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var bind_1 = require("angular2/src/web_workers/ui/bind"); + var event_dispatcher_1 = require("angular2/src/web_workers/ui/event_dispatcher"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + var service_message_broker_1 = require("angular2/src/web_workers/shared/service_message_broker"); + var MessageBasedRenderer = (function() { + function MessageBasedRenderer(_brokerFactory, _bus, _serializer, _renderViewWithFragmentsStore, _renderer) { + this._brokerFactory = _brokerFactory; + this._bus = _bus; + this._serializer = _serializer; + this._renderViewWithFragmentsStore = _renderViewWithFragmentsStore; + this._renderer = _renderer; + } + MessageBasedRenderer.prototype.start = function() { + var broker = this._brokerFactory.createMessageBroker(messaging_api_1.RENDERER_CHANNEL); + this._bus.initChannel(messaging_api_1.EVENT_CHANNEL); + broker.registerMethod("createRootHostView", [api_1.RenderProtoViewRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._createRootHostView, this)); + broker.registerMethod("createView", [api_1.RenderProtoViewRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._createView, this)); + broker.registerMethod("destroyView", [api_1.RenderViewRef], bind_1.bind(this._destroyView, this)); + broker.registerMethod("attachFragmentAfterFragment", [api_1.RenderFragmentRef, api_1.RenderFragmentRef], bind_1.bind(this._renderer.attachFragmentAfterFragment, this._renderer)); + broker.registerMethod("attachFragmentAfterElement", [api_2.WebWorkerElementRef, api_1.RenderFragmentRef], bind_1.bind(this._renderer.attachFragmentAfterElement, this._renderer)); + broker.registerMethod("detachFragment", [api_1.RenderFragmentRef], bind_1.bind(this._renderer.detachFragment, this._renderer)); + broker.registerMethod("hydrateView", [api_1.RenderViewRef], bind_1.bind(this._renderer.hydrateView, this._renderer)); + broker.registerMethod("dehydrateView", [api_1.RenderViewRef], bind_1.bind(this._renderer.dehydrateView, this._renderer)); + broker.registerMethod("setText", [api_1.RenderViewRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.setText, this._renderer)); + broker.registerMethod("setElementProperty", [api_2.WebWorkerElementRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.setElementProperty, this._renderer)); + broker.registerMethod("setElementAttribute", [api_2.WebWorkerElementRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.setElementAttribute, this._renderer)); + broker.registerMethod("setElementClass", [api_2.WebWorkerElementRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.setElementClass, this._renderer)); + broker.registerMethod("setElementStyle", [api_2.WebWorkerElementRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.setElementStyle, this._renderer)); + broker.registerMethod("invokeElementMethod", [api_2.WebWorkerElementRef, serializer_1.PRIMITIVE, serializer_1.PRIMITIVE], bind_1.bind(this._renderer.invokeElementMethod, this._renderer)); + broker.registerMethod("setEventDispatcher", [api_1.RenderViewRef], bind_1.bind(this._setEventDispatcher, this)); + }; + MessageBasedRenderer.prototype._destroyView = function(viewRef) { + this._renderer.destroyView(viewRef); + this._renderViewWithFragmentsStore.remove(viewRef); + }; + MessageBasedRenderer.prototype._createRootHostView = function(ref, fragmentCount, selector, startIndex) { + var renderViewWithFragments = this._renderer.createRootHostView(ref, fragmentCount, selector); + this._renderViewWithFragmentsStore.store(renderViewWithFragments, startIndex); + }; + MessageBasedRenderer.prototype._createView = function(ref, fragmentCount, startIndex) { + var renderViewWithFragments = this._renderer.createView(ref, fragmentCount); + this._renderViewWithFragmentsStore.store(renderViewWithFragments, startIndex); + }; + MessageBasedRenderer.prototype._setEventDispatcher = function(viewRef) { + var dispatcher = new event_dispatcher_1.EventDispatcher(viewRef, this._bus.to(messaging_api_1.EVENT_CHANNEL), this._serializer); + this._renderer.setEventDispatcher(viewRef, dispatcher); + }; + MessageBasedRenderer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [service_message_broker_1.ServiceMessageBrokerFactory, message_bus_1.MessageBus, serializer_1.Serializer, render_view_with_fragments_store_1.RenderViewWithFragmentsStore, api_1.Renderer])], MessageBasedRenderer); + return MessageBasedRenderer; + })(); + exports.MessageBasedRenderer = MessageBasedRenderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +/** + @license + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015 Netflix, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/post_message_bus", ["angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var PostMessageBus = (function() { + function PostMessageBus(sink, source) { + this.sink = sink; + this.source = source; + } + PostMessageBus.prototype.attachToZone = function(zone) { + this.source.attachToZone(zone); + this.sink.attachToZone(zone); + }; + PostMessageBus.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this.source.initChannel(channel, runInZone); + this.sink.initChannel(channel, runInZone); + }; + PostMessageBus.prototype.from = function(channel) { + return this.source.from(channel); + }; + PostMessageBus.prototype.to = function(channel) { + return this.sink.to(channel); + }; + PostMessageBus = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [PostMessageBusSink, PostMessageBusSource])], PostMessageBus); + return PostMessageBus; + })(); + exports.PostMessageBus = PostMessageBus; + var PostMessageBusSink = (function() { + function PostMessageBusSink(_postMessageTarget) { + this._postMessageTarget = _postMessageTarget; + this._channels = collection_1.StringMapWrapper.create(); + this._messageBuffer = []; + } + PostMessageBusSink.prototype.attachToZone = function(zone) { + var _this = this; + this._zone = zone; + this._zone.overrideOnEventDone(function() { + return _this._handleOnEventDone(); + }, false); + }; + PostMessageBusSink.prototype.initChannel = function(channel, runInZone) { + var _this = this; + if (runInZone === void 0) { + runInZone = true; + } + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + throw new exceptions_1.BaseException(channel + " has already been initialized"); + } + var emitter = new async_1.EventEmitter(); + var channelInfo = new _Channel(emitter, runInZone); + this._channels[channel] = channelInfo; + emitter.observer({next: function(data) { + var message = { + channel: channel, + message: data + }; + if (runInZone) { + _this._messageBuffer.push(message); + } else { + _this._sendMessages([message]); + } + }}); + }; + PostMessageBusSink.prototype.to = function(channel) { + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + return this._channels[channel].emitter; + } else { + throw new exceptions_1.BaseException(channel + " is not set up. Did you forget to call initChannel?"); + } + }; + PostMessageBusSink.prototype._handleOnEventDone = function() { + this._sendMessages(this._messageBuffer); + this._messageBuffer = []; + }; + PostMessageBusSink.prototype._sendMessages = function(messages) { + this._postMessageTarget.postMessage(messages); + }; + return PostMessageBusSink; + })(); + exports.PostMessageBusSink = PostMessageBusSink; + var PostMessageBusSource = (function() { + function PostMessageBusSource(eventTarget) { + var _this = this; + this._channels = collection_1.StringMapWrapper.create(); + if (eventTarget) { + eventTarget.addEventListener("message", function(ev) { + return _this._handleMessages(ev); + }); + } else { + addEventListener("message", function(ev) { + return _this._handleMessages(ev); + }); + } + } + PostMessageBusSource.prototype.attachToZone = function(zone) { + this._zone = zone; + }; + PostMessageBusSource.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + throw new exceptions_1.BaseException(channel + " has already been initialized"); + } + var emitter = new async_1.EventEmitter(); + var channelInfo = new _Channel(emitter, runInZone); + this._channels[channel] = channelInfo; + }; + PostMessageBusSource.prototype.from = function(channel) { + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + return this._channels[channel].emitter; + } else { + throw new exceptions_1.BaseException(channel + " is not set up. Did you forget to call initChannel?"); + } + }; + PostMessageBusSource.prototype._handleMessages = function(ev) { + var messages = ev.data; + for (var i = 0; i < messages.length; i++) { + this._handleMessage(messages[i]); + } + }; + PostMessageBusSource.prototype._handleMessage = function(data) { + var channel = data.channel; + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + var channelInfo = this._channels[channel]; + if (channelInfo.runInZone) { + this._zone.run(function() { + channelInfo.emitter.next(data.message); + }); + } else { + channelInfo.emitter.next(data.message); + } + } + }; + return PostMessageBusSource; + })(); + exports.PostMessageBusSource = PostMessageBusSource; + var _Channel = (function() { + function _Channel(emitter, runInZone) { + this.emitter = emitter; + this.runInZone = runInZone; + } + return _Channel; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/di_bindings", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/animate/animation_builder", "angular2/src/animate/browser_details", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/compiler/compiler", "angular2/src/core/dom/browser_adapter", "angular2/src/core/render/dom/events/key_events", "angular2/src/core/render/dom/events/hammer_gestures", "angular2/src/core/compiler/view_pool", "angular2/src/core/render/api", "angular2/src/core/services/app_root_url", "angular2/src/core/render/render", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/render/dom/schema/dom_element_schema_registry", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/compiler/view_resolver", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/testability/testability", "angular2/src/core/render/xhr", "angular2/src/core/render/xhr_impl", "angular2/src/web_workers/shared/serializer", "angular2/src/web_workers/shared/api", "angular2/src/web_workers/shared/render_proto_view_ref_store", "angular2/src/web_workers/shared/render_view_with_fragments_store", "angular2/src/core/services/anchor_based_app_root_url", "angular2/src/web_workers/ui/impl", "angular2/src/web_workers/shared/message_bus", "angular2/src/web_workers/ui/render_compiler", "angular2/src/web_workers/ui/renderer", "angular2/src/web_workers/ui/xhr_impl", "angular2/src/web_workers/ui/setup", "angular2/src/web_workers/shared/service_message_broker", "angular2/src/web_workers/shared/client_message_broker"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var key_events_1 = require("angular2/src/core/render/dom/events/key_events"); + var hammer_gestures_1 = require("angular2/src/core/render/dom/events/hammer_gestures"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var api_1 = require("angular2/src/core/render/api"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var render_1 = require("angular2/src/core/render/render"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var dom_element_schema_registry_1 = require("angular2/src/core/render/dom/schema/dom_element_schema_registry"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var testability_1 = require("angular2/src/core/testability/testability"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/core/render/xhr_impl"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var render_proto_view_ref_store_1 = require("angular2/src/web_workers/shared/render_proto_view_ref_store"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + var anchor_based_app_root_url_1 = require("angular2/src/core/services/anchor_based_app_root_url"); + var impl_1 = require("angular2/src/web_workers/ui/impl"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var render_compiler_1 = require("angular2/src/web_workers/ui/render_compiler"); + var renderer_1 = require("angular2/src/web_workers/ui/renderer"); + var xhr_impl_2 = require("angular2/src/web_workers/ui/xhr_impl"); + var setup_1 = require("angular2/src/web_workers/ui/setup"); + var service_message_broker_1 = require("angular2/src/web_workers/shared/service_message_broker"); + var client_message_broker_1 = require("angular2/src/web_workers/shared/client_message_broker"); + var _rootInjector; + var _rootBindings = [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector)]; + function _injectorBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [di_1.bind(render_1.DOCUMENT).toValue(dom_adapter_1.DOM.defaultDoc()), event_manager_1.EventManager, new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: event_manager_1.DomEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: key_events_1.KeyEventsPlugin, + multi: true + }), new di_1.Binding(event_manager_1.EVENT_MANAGER_PLUGINS, { + toClass: hammer_gestures_1.HammerGesturesPlugin, + multi: true + }), render_1.DomRenderer, di_1.bind(api_1.Renderer).toAlias(render_1.DomRenderer), render_1.APP_ID_RANDOM_BINDING, render_1.TemplateCloner, di_1.bind(render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE).toValue(20), render_1.DefaultDomCompiler, di_1.bind(api_1.RenderCompiler).toAlias(render_1.DefaultDomCompiler), shared_styles_host_1.DomSharedStylesHost, di_1.bind(shared_styles_host_1.SharedStylesHost).toAlias(shared_styles_host_1.DomSharedStylesHost), serializer_1.Serializer, di_1.bind(api_2.ON_WEB_WORKER).toValue(false), di_1.bind(element_schema_registry_1.ElementSchemaRegistry).toValue(new dom_element_schema_registry_1.DomElementSchemaRegistry()), render_view_with_fragments_store_1.RenderViewWithFragmentsStore, render_proto_view_ref_store_1.RenderProtoViewRefStore, proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), view_loader_1.ViewLoader, directive_resolver_1.DirectiveResolver, change_detection_1.Parser, change_detection_1.Lexer, di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(dom_adapter_1.DOM); + }, []), di_1.bind(xhr_1.XHR).toValue(new xhr_impl_1.XHRImpl()), component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, style_inliner_1.StyleInliner, dynamic_component_loader_1.DynamicComponentLoader, testability_1.Testability, anchor_based_app_root_url_1.AnchorBasedAppRootUrl, di_1.bind(app_root_url_1.AppRootUrl).toAlias(anchor_based_app_root_url_1.AnchorBasedAppRootUrl), impl_1.WebWorkerApplication, setup_1.WebWorkerSetup, render_compiler_1.MessageBasedRenderCompiler, xhr_impl_2.MessageBasedXHRImpl, renderer_1.MessageBasedRenderer, service_message_broker_1.ServiceMessageBrokerFactory, client_message_broker_1.ClientMessageBrokerFactory, browser_details_1.BrowserDetails, animation_builder_1.AnimationBuilder]; + } + function createInjector(zone, bus) { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + _rootBindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + _rootBindings.push(di_1.bind(message_bus_1.MessageBus).toValue(bus)); + var injector = di_1.Injector.resolveAndCreate(_rootBindings); + return injector.resolveAndCreateChild(_injectorBindings()); + } + exports.createInjector = createInjector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/impl", ["angular2/src/web_workers/ui/di_bindings", "angular2/src/core/application_ref", "angular2/src/core/di", "angular2/src/core/dom/browser_adapter", "angular2/src/core/profile/wtf_init", "angular2/src/web_workers/ui/setup", "angular2/src/web_workers/ui/render_compiler", "angular2/src/web_workers/ui/renderer", "angular2/src/web_workers/ui/xhr_impl", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/web_workers/shared/service_message_broker"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var di_bindings_1 = require("angular2/src/web_workers/ui/di_bindings"); + var application_ref_1 = require("angular2/src/core/application_ref"); + var di_1 = require("angular2/src/core/di"); + var browser_adapter_1 = require("angular2/src/core/dom/browser_adapter"); + var wtf_init_1 = require("angular2/src/core/profile/wtf_init"); + var setup_1 = require("angular2/src/web_workers/ui/setup"); + var render_compiler_1 = require("angular2/src/web_workers/ui/render_compiler"); + var renderer_1 = require("angular2/src/web_workers/ui/renderer"); + var xhr_impl_1 = require("angular2/src/web_workers/ui/xhr_impl"); + var client_message_broker_1 = require("angular2/src/web_workers/shared/client_message_broker"); + var service_message_broker_1 = require("angular2/src/web_workers/shared/service_message_broker"); + function bootstrapUICommon(bus) { + browser_adapter_1.BrowserDomAdapter.makeCurrent(); + var zone = application_ref_1.createNgZone(); + wtf_init_1.wtfInit(); + bus.attachToZone(zone); + return zone.run(function() { + var injector = di_bindings_1.createInjector(zone, bus); + injector.get(render_compiler_1.MessageBasedRenderCompiler).start(); + injector.get(renderer_1.MessageBasedRenderer).start(); + injector.get(xhr_impl_1.MessageBasedXHRImpl).start(); + injector.get(setup_1.WebWorkerSetup).start(); + return injector.get(WebWorkerApplication); + }); + } + exports.bootstrapUICommon = bootstrapUICommon; + var WebWorkerApplication = (function() { + function WebWorkerApplication(_clientMessageBrokerFactory, _serviceMessageBrokerFactory) { + this._clientMessageBrokerFactory = _clientMessageBrokerFactory; + this._serviceMessageBrokerFactory = _serviceMessageBrokerFactory; + } + WebWorkerApplication.prototype.createClientMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + return this._clientMessageBrokerFactory.createMessageBroker(channel, runInZone); + }; + WebWorkerApplication.prototype.createServiceMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + return this._serviceMessageBrokerFactory.createMessageBroker(channel, runInZone); + }; + WebWorkerApplication = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [client_message_broker_1.ClientMessageBrokerFactory, service_message_broker_1.ServiceMessageBrokerFactory])], WebWorkerApplication); + return WebWorkerApplication; + })(); + exports.WebWorkerApplication = WebWorkerApplication; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/ui/application", ["angular2/src/web_workers/shared/post_message_bus", "angular2/src/web_workers/ui/impl", "angular2/src/web_workers/ui/impl", "angular2/src/web_workers/shared/message_bus"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var post_message_bus_1 = require("angular2/src/web_workers/shared/post_message_bus"); + var impl_1 = require("angular2/src/web_workers/ui/impl"); + var impl_2 = require("angular2/src/web_workers/ui/impl"); + exports.WebWorkerApplication = impl_2.WebWorkerApplication; + __export(require("angular2/src/web_workers/shared/message_bus")); + function bootstrap(uri) { + var instance = spawnWebWorker(uri); + instance.app = impl_1.bootstrapUICommon(instance.bus); + return instance; + } + exports.bootstrap = bootstrap; + function spawnWebWorker(uri) { + var webWorker = new Worker(uri); + var sink = new post_message_bus_1.PostMessageBusSink(webWorker); + var source = new post_message_bus_1.PostMessageBusSource(webWorker); + var bus = new post_message_bus_1.PostMessageBus(sink, source); + return new WebWorkerInstance(null, webWorker, bus); + } + exports.spawnWebWorker = spawnWebWorker; + var WebWorkerInstance = (function() { + function WebWorkerInstance(app, worker, bus) { + this.app = app; + this.worker = worker; + this.bus = bus; + } + return WebWorkerInstance; + })(); + exports.WebWorkerInstance = WebWorkerInstance; + global.define = __define; + return module.exports; +}); + +System.register("angular2/web_worker/ui", ["angular2/src/core/facade", "angular2/src/core/zone", "angular2/src/web_workers/ui/application", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/web_workers/shared/service_message_broker", "angular2/src/web_workers/shared/serializer"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/zone")); + __export(require("angular2/src/web_workers/ui/application")); + __export(require("angular2/src/web_workers/shared/client_message_broker")); + __export(require("angular2/src/web_workers/shared/service_message_broker")); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + exports.PRIMITIVE = serializer_1.PRIMITIVE; + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=ui.dev.js.map \ No newline at end of file diff --git a/2.0.0-snapshot/web_worker/worker.dev.js b/2.0.0-snapshot/web_worker/worker.dev.js new file mode 100644 index 0000000000..5ad61a34fe --- /dev/null +++ b/2.0.0-snapshot/web_worker/worker.dev.js @@ -0,0 +1,30090 @@ +/** + @license +Copyright 2014-2015 Google, Inc. http://angularjs.org + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + */ + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1; + +// TODO(vicb): remove '!isFirefox' when the bug gets fixed: +// https://bugzilla.mozilla.org/show_bug.cgi?id=1162013 +if (hasNativePromise && !isFirefox) { + // When available use a native Promise to schedule microtasks. + // When not available, es6-promise fallback will be used + var resolvedPromise = Promise.resolve(); + es6Promise._setScheduler(function(fn) { + resolvedPromise.then(fn); + }); +} + + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"es6-promise":15}],4:[function(require,module,exports){ +(function (global){ +'use strict'; + +var fnPatch = require('./functions'); +var promisePatch = require('./promise'); +var mutationObserverPatch = require('./mutation-observer'); +var definePropertyPatch = require('./define-property'); +var registerElementPatch = require('./register-element'); +var webSocketPatch = require('./websocket'); +var eventTargetPatch = require('./event-target'); +var propertyDescriptorPatch = require('./property-descriptor'); +var geolocationPatch = require('./geolocation'); + +function apply() { + fnPatch.patchSetClearFunction(global, [ + 'timeout', + 'interval', + 'immediate' + ]); + + fnPatch.patchRequestAnimationFrame(global, [ + 'requestAnimationFrame', + 'mozRequestAnimationFrame', + 'webkitRequestAnimationFrame' + ]); + + fnPatch.patchFunction(global, [ + 'alert', + 'prompt' + ]); + + eventTargetPatch.apply(); + + propertyDescriptorPatch.apply(); + + promisePatch.apply(); + + mutationObserverPatch.patchClass('MutationObserver'); + mutationObserverPatch.patchClass('WebKitMutationObserver'); + + definePropertyPatch.apply(); + + registerElementPatch.apply(); + + geolocationPatch.apply(); +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./define-property":5,"./event-target":6,"./functions":7,"./geolocation":8,"./mutation-observer":9,"./promise":10,"./property-descriptor":11,"./register-element":12,"./websocket":13}],5:[function(require,module,exports){ +'use strict'; + +// might need similar for object.freeze +// i regret nothing + +var _defineProperty = Object.defineProperty; +var _getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; +var _create = Object.create; + +function apply() { + Object.defineProperty = function (obj, prop, desc) { + if (isUnconfigurable(obj, prop)) { + throw new TypeError('Cannot assign to read only property \'' + prop + '\' of ' + obj); + } + if (prop !== 'prototype') { + desc = rewriteDescriptor(obj, prop, desc); + } + return _defineProperty(obj, prop, desc); + }; + + Object.defineProperties = function (obj, props) { + Object.keys(props).forEach(function (prop) { + Object.defineProperty(obj, prop, props[prop]); + }); + return obj; + }; + + Object.create = function (obj, proto) { + if (typeof proto === 'object') { + Object.keys(proto).forEach(function (prop) { + proto[prop] = rewriteDescriptor(obj, prop, proto[prop]); + }); + } + return _create(obj, proto); + }; + + Object.getOwnPropertyDescriptor = function (obj, prop) { + var desc = _getOwnPropertyDescriptor(obj, prop); + if (isUnconfigurable(obj, prop)) { + desc.configurable = false; + } + return desc; + }; +}; + +function _redefineProperty(obj, prop, desc) { + desc = rewriteDescriptor(obj, prop, desc); + return _defineProperty(obj, prop, desc); +}; + +function isUnconfigurable (obj, prop) { + return obj && obj.__unconfigurables && obj.__unconfigurables[prop]; +} + +function rewriteDescriptor (obj, prop, desc) { + desc.configurable = true; + if (!desc.configurable) { + if (!obj.__unconfigurables) { + _defineProperty(obj, '__unconfigurables', { writable: true, value: {} }); + } + obj.__unconfigurables[prop] = true; + } + return desc; +} + +module.exports = { + apply: apply, + _redefineProperty: _redefineProperty +}; + + + +},{}],6:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + // patched properties depend on addEventListener, so this needs to come first + if (global.EventTarget) { + utils.patchEventTargetMethods(global.EventTarget.prototype); + + // Note: EventTarget is not available in all browsers, + // if it's not available, we instead patch the APIs in the IDL that inherit from EventTarget + } else { + var apis = [ 'ApplicationCache', + 'EventSource', + 'FileReader', + 'InputMethodContext', + 'MediaController', + 'MessagePort', + 'Node', + 'Performance', + 'SVGElementInstance', + 'SharedWorker', + 'TextTrack', + 'TextTrackCue', + 'TextTrackList', + 'WebKitNamedFlow', + 'Window', + 'Worker', + 'WorkerGlobalScope', + 'XMLHttpRequest', + 'XMLHttpRequestEventTarget', + 'XMLHttpRequestUpload' + ]; + + apis.forEach(function(thing) { + global[thing] && utils.patchEventTargetMethods(global[thing].prototype); + }); + } +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],7:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function patchSetClearFunction(obj, fnNames) { + fnNames.map(function (name) { + return name[0].toUpperCase() + name.substr(1); + }).forEach(function (name) { + var setName = 'set' + name; + var delegate = obj[setName]; + + if (delegate) { + var clearName = 'clear' + name; + var ids = {}; + + var bindArgs = setName === 'setInterval' ? utils.bindArguments : utils.bindArgumentsOnce; + + global.zone[setName] = function (fn) { + var id, fnRef = fn; + arguments[0] = function () { + delete ids[id]; + return fnRef.apply(this, arguments); + }; + var args = bindArgs(arguments); + id = delegate.apply(obj, args); + ids[id] = true; + return id; + }; + + obj[setName] = function () { + return global.zone[setName].apply(this, arguments); + }; + + var clearDelegate = obj[clearName]; + + global.zone[clearName] = function (id) { + if (ids[id]) { + delete ids[id]; + global.zone.dequeueTask(); + } + return clearDelegate.apply(this, arguments); + }; + + obj[clearName] = function () { + return global.zone[clearName].apply(this, arguments); + }; + } + }); +}; + + +/** + * requestAnimationFrame is typically recursively called from within the callback function + * that it executes. To handle this case, only fork a zone if this is executed + * within the root zone. + */ +function patchRequestAnimationFrame(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + global.zone[name] = function (fn) { + var callZone = global.zone.isRootZone() ? global.zone.fork() : global.zone; + if (fn) { + arguments[0] = function () { + return callZone.run(fn, arguments); + }; + } + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchSetFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + + if (delegate) { + global.zone[name] = function (fn) { + var fnRef = fn; + arguments[0] = function () { + return fnRef.apply(this, arguments); + }; + var args = utils.bindArgumentsOnce(arguments); + return delegate.apply(obj, args); + }; + + obj[name] = function () { + return zone[name].apply(this, arguments); + }; + } + }); +}; + +function patchFunction(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + global.zone[name] = function () { + return delegate.apply(obj, arguments); + }; + + obj[name] = function () { + return global.zone[name].apply(this, arguments); + }; + }); +}; + + +module.exports = { + patchSetClearFunction: patchSetClearFunction, + patchSetFunction: patchSetFunction, + patchRequestAnimationFrame: patchRequestAnimationFrame, + patchFunction: patchFunction +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],8:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +function apply() { + if (global.navigator && global.navigator.geolocation) { + utils.patchPrototype(global.navigator.geolocation, [ + 'getCurrentPosition', + 'watchPosition' + ]); + } +} + +module.exports = { + apply: apply +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],9:[function(require,module,exports){ +(function (global){ +'use strict'; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function (fn) { + this._o = new OriginalClass(global.zone.bind(fn, true)); + // Remember where the class was instantiate to execute the enqueueTask and dequeueTask hooks + this._creationZone = global.zone; + }; + + var instance = new OriginalClass(function () {}); + + global[className].prototype.disconnect = function () { + var result = this._o.disconnect.apply(this._o, arguments); + if (this._active) { + this._creationZone.dequeueTask(); + this._active = false; + } + return result; + }; + + global[className].prototype.observe = function () { + if (!this._active) { + this._creationZone.enqueueTask(); + this._active = true; + } + return this._o.observe.apply(this._o, arguments); + }; + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof global[className].prototype !== undefined) { + return; + } + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } +}; + +module.exports = { + patchClass: patchClass +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],10:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +/* + * Patches a function that returns a Promise-like instance. + * + * This function must be used when either: + * - Native Promises are not available, + * - The function returns a Promise-like object. + * + * This is required because zones rely on a Promise monkey patch that could not be applied when + * Promise is not natively available or when the returned object is not an instance of Promise. + * + * Note that calling `bindPromiseFn` on a function that returns a native Promise will also work + * with minimal overhead. + * + * ``` + * var boundFunction = bindPromiseFn(FunctionReturningAPromise); + * + * boundFunction.then(successHandler, errorHandler); + * ``` + */ +var bindPromiseFn; + +if (global.Promise) { + bindPromiseFn = function (delegate) { + return function() { + var delegatePromise = delegate.apply(this, arguments); + + // if the delegate returned an instance of Promise, forward it. + if (delegatePromise instanceof Promise) { + return delegatePromise; + } + + // Otherwise wrap the Promise-like in a global Promise + return new Promise(function(resolve, reject) { + delegatePromise.then(resolve, reject); + }); + }; + }; +} else { + bindPromiseFn = function (delegate) { + return function () { + return _patchThenable(delegate.apply(this, arguments)); + }; + }; +} + + +function _patchPromiseFnsOnObject(objectPath, fnNames) { + var obj = global; + + var exists = objectPath.every(function (segment) { + obj = obj[segment]; + return obj; + }); + + if (!exists) { + return; + } + + fnNames.forEach(function (name) { + var fn = obj[name]; + if (fn) { + obj[name] = bindPromiseFn(fn); + } + }); +} + +function _patchThenable(thenable) { + var then = thenable.then; + thenable.then = function () { + var args = utils.bindArguments(arguments); + var nextThenable = then.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + var ocatch = thenable.catch; + thenable.catch = function () { + var args = utils.bindArguments(arguments); + var nextThenable = ocatch.apply(thenable, args); + return _patchThenable(nextThenable); + }; + + return thenable; +} + + +function apply() { + // Patch .then() and .catch() on native Promises to execute callbacks in the zone where + // those functions are called. + if (global.Promise) { + utils.patchPrototype(Promise.prototype, [ + 'then', + 'catch' + ]); + + // Patch browser APIs that return a Promise + var patchFns = [ + // fetch + [[], ['fetch']], + [['Response', 'prototype'], ['arrayBuffer', 'blob', 'json', 'text']] + ]; + + patchFns.forEach(function(objPathAndFns) { + _patchPromiseFnsOnObject(objPathAndFns[0], objPathAndFns[1]); + }); + } +} + +module.exports = { + apply: apply, + bindPromiseFn: bindPromiseFn +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var webSocketPatch = require('./websocket'); +var utils = require('../utils'); + +var eventNames = 'copy cut paste abort blur focus canplay canplaythrough change click contextmenu dblclick drag dragend dragenter dragleave dragover dragstart drop durationchange emptied ended input invalid keydown keypress keyup load loadeddata loadedmetadata loadstart message mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup pause play playing progress ratechange reset scroll seeked seeking select show stalled submit suspend timeupdate volumechange waiting mozfullscreenchange mozfullscreenerror mozpointerlockchange mozpointerlockerror error webglcontextrestored webglcontextlost webglcontextcreationerror'.split(' '); + +function apply() { + if (utils.isWebWorker()){ + // on WebWorker so don't apply patch + return; + } + + var supportsWebSocket = typeof WebSocket !== 'undefined'; + if (canPatchViaPropertyDescriptor()) { + // for browsers that we can patch the descriptor: Chrome & Firefox + var onEventNames = eventNames.map(function (property) { + return 'on' + property; + }); + utils.patchProperties(HTMLElement.prototype, onEventNames); + utils.patchProperties(XMLHttpRequest.prototype); + if (supportsWebSocket) { + utils.patchProperties(WebSocket.prototype); + } + } else { + // Safari, Android browsers (Jelly Bean) + patchViaCapturingAllTheEvents(); + utils.patchClass('XMLHttpRequest'); + if (supportsWebSocket) { + webSocketPatch.apply(); + } + } +} + +function canPatchViaPropertyDescriptor() { + if (!Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'onclick') && typeof Element !== 'undefined') { + // WebKit https://bugs.webkit.org/show_bug.cgi?id=134364 + // IDL interface attributes are not configurable + var desc = Object.getOwnPropertyDescriptor(Element.prototype, 'onclick'); + if (desc && !desc.configurable) return false; + } + + Object.defineProperty(HTMLElement.prototype, 'onclick', { + get: function () { + return true; + } + }); + var elt = document.createElement('div'); + var result = !!elt.onclick; + Object.defineProperty(HTMLElement.prototype, 'onclick', {}); + return result; +}; + +// Whenever any event fires, we check the event target and all parents +// for `onwhatever` properties and replace them with zone-bound functions +// - Chrome (for now) +function patchViaCapturingAllTheEvents() { + eventNames.forEach(function (property) { + var onproperty = 'on' + property; + document.addEventListener(property, function (event) { + var elt = event.target, bound; + while (elt) { + if (elt[onproperty] && !elt[onproperty]._unbound) { + bound = global.zone.bind(elt[onproperty]); + bound._unbound = elt[onproperty]; + elt[onproperty] = bound; + } + elt = elt.parentElement; + } + }, true); + }); +}; + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./websocket":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var _redefineProperty = require('./define-property')._redefineProperty; +var utils = require("../utils"); + +function apply() { + if (utils.isWebWorker() || !('registerElement' in global.document)) { + return; + } + + var _registerElement = document.registerElement; + var callbacks = [ + 'createdCallback', + 'attachedCallback', + 'detachedCallback', + 'attributeChangedCallback' + ]; + + document.registerElement = function (name, opts) { + if (opts && opts.prototype) { + callbacks.forEach(function (callback) { + if (opts.prototype.hasOwnProperty(callback)) { + var descriptor = Object.getOwnPropertyDescriptor(opts.prototype, callback); + if (descriptor && descriptor.value) { + descriptor.value = global.zone.bind(descriptor.value); + _redefineProperty(opts.prototype, callback, descriptor); + } else { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + } else if (opts.prototype[callback]) { + opts.prototype[callback] = global.zone.bind(opts.prototype[callback]); + } + }); + } + + return _registerElement.apply(document, [name, opts]); + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14,"./define-property":5}],13:[function(require,module,exports){ +(function (global){ +'use strict'; + +var utils = require('../utils'); + +// we have to patch the instance since the proto is non-configurable +function apply() { + var WS = global.WebSocket; + utils.patchEventTargetMethods(WS.prototype); + global.WebSocket = function(a, b) { + var socket = arguments.length > 1 ? new WS(a, b) : new WS(a); + var proxySocket; + + // Safari 7.0 has non-configurable own 'onmessage' and friends properties on the socket instance + var onmessageDesc = Object.getOwnPropertyDescriptor(socket, 'onmessage'); + if (onmessageDesc && onmessageDesc.configurable === false) { + proxySocket = Object.create(socket); + ['addEventListener', 'removeEventListener', 'send', 'close'].forEach(function(propName) { + proxySocket[propName] = function() { + return socket[propName].apply(socket, arguments); + }; + }); + } else { + // we can patch the real socket + proxySocket = socket; + } + + utils.patchProperties(proxySocket, ['onclose', 'onerror', 'onmessage', 'onopen']); + + return proxySocket; + }; +} + +module.exports = { + apply: apply +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../utils":14}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +function bindArguments(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bind(args[i]); + } + } + return args; +}; + +function bindArgumentsOnce(args) { + for (var i = args.length - 1; i >= 0; i--) { + if (typeof args[i] === 'function') { + args[i] = global.zone.bindOnce(args[i]); + } + } + return args; +}; + +function patchPrototype(obj, fnNames) { + fnNames.forEach(function (name) { + var delegate = obj[name]; + if (delegate) { + obj[name] = function () { + return delegate.apply(this, bindArguments(arguments)); + }; + } + }); +}; + +function isWebWorker() { + return (typeof document === "undefined"); +} + +function patchProperty(obj, prop) { + var desc = Object.getOwnPropertyDescriptor(obj, prop) || { + enumerable: true, + configurable: true + }; + + // A property descriptor cannot have getter/setter and be writable + // deleting the writable and value properties avoids this error: + // + // TypeError: property descriptors must not specify a value or be writable when a + // getter or setter has been specified + delete desc.writable; + delete desc.value; + + // substr(2) cuz 'onclick' -> 'click', etc + var eventName = prop.substr(2); + var _prop = '_' + prop; + + desc.set = function (fn) { + if (this[_prop]) { + this.removeEventListener(eventName, this[_prop]); + } + + if (typeof fn === 'function') { + this[_prop] = fn; + this.addEventListener(eventName, fn, false); + } else { + this[_prop] = null; + } + }; + + desc.get = function () { + return this[_prop]; + }; + + Object.defineProperty(obj, prop, desc); +}; + +function patchProperties(obj, properties) { + + (properties || (function () { + var props = []; + for (var prop in obj) { + props.push(prop); + } + return props; + }()). + filter(function (propertyName) { + return propertyName.substr(0,2) === 'on'; + })). + forEach(function (eventName) { + patchProperty(obj, eventName); + }); +}; + +function patchEventTargetMethods(obj) { + var addDelegate = obj.addEventListener; + obj.addEventListener = function (eventName, handler) { + var fn; + //Ignore special listeners of IE11 & Edge dev tools, see https://github.com/angular/zone.js/issues/150 + if (handler.toString() !== "[object FunctionWrapper]") { + if (handler.handleEvent) { + // Have to pass in 'handler' reference as an argument here, otherwise it gets clobbered in + // IE9 by the arguments[1] assignment at end of this function. + fn = (function(handler) { + return function() { + handler.handleEvent.apply(handler, arguments); + }; + })(handler); + } else { + fn = handler; + } + + handler._fn = fn; + handler._bound = handler._bound || {}; + arguments[1] = handler._bound[eventName] = zone.bind(fn); + } + return addDelegate.apply(this, arguments); + }; + + var removeDelegate = obj.removeEventListener; + obj.removeEventListener = function (eventName, handler) { + if(handler._bound && handler._bound[eventName]) { + var _bound = handler._bound; + + arguments[1] = _bound[eventName]; + delete _bound[eventName]; + } + var result = removeDelegate.apply(this, arguments); + global.zone.dequeueTask(handler._fn); + return result; + }; +}; + +// wrap some native API on `window` +function patchClass(className) { + var OriginalClass = global[className]; + if (!OriginalClass) return; + + global[className] = function () { + var a = bindArguments(arguments); + switch (a.length) { + case 0: this._o = new OriginalClass(); break; + case 1: this._o = new OriginalClass(a[0]); break; + case 2: this._o = new OriginalClass(a[0], a[1]); break; + case 3: this._o = new OriginalClass(a[0], a[1], a[2]); break; + case 4: this._o = new OriginalClass(a[0], a[1], a[2], a[3]); break; + default: throw new Error('what are you even doing?'); + } + }; + + var instance = new OriginalClass(); + + var prop; + for (prop in instance) { + (function (prop) { + if (typeof instance[prop] === 'function') { + global[className].prototype[prop] = function () { + return this._o[prop].apply(this._o, arguments); + }; + } else { + Object.defineProperty(global[className].prototype, prop, { + set: function (fn) { + if (typeof fn === 'function') { + this._o[prop] = global.zone.bind(fn); + } else { + this._o[prop] = fn; + } + }, + get: function () { + return this._o[prop]; + } + }); + } + }(prop)); + } + + for (prop in OriginalClass) { + if (prop !== 'prototype' && OriginalClass.hasOwnProperty(prop)) { + global[className][prop] = OriginalClass[prop]; + } + } +}; + +module.exports = { + bindArguments: bindArguments, + bindArgumentsOnce: bindArgumentsOnce, + patchPrototype: patchPrototype, + patchProperty: patchProperty, + patchProperties: patchProperties, + patchEventTargetMethods: patchEventTargetMethods, + patchClass: patchClass, + isWebWorker: isWebWorker +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],15:[function(require,module,exports){ +(function (process,global){ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.3.0 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + var lib$es6$promise$asap$$customSchedulerFn; + + var lib$es6$promise$asap$$asap = function asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (lib$es6$promise$asap$$customSchedulerFn) { + lib$es6$promise$asap$$customSchedulerFn(lib$es6$promise$asap$$flush); + } else { + lib$es6$promise$asap$$scheduleFlush(); + } + } + } + + function lib$es6$promise$asap$$setScheduler(scheduleFn) { + lib$es6$promise$asap$$customSchedulerFn = scheduleFn; + } + + function lib$es6$promise$asap$$setAsap(asapFn) { + lib$es6$promise$asap$$asap = asapFn; + } + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$asap(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$asap(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + lib$es6$promise$promise$$Promise._setScheduler = lib$es6$promise$asap$$setScheduler; + lib$es6$promise$promise$$Promise._setAsap = lib$es6$promise$asap$$setAsap; + lib$es6$promise$promise$$Promise._asap = lib$es6$promise$asap$$asap; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$asap(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + + +}).call(this,{},typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}]},{},[1]); + +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, targetKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasMetadata(metadataKey, target, targetKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryHasOwnMetadata(metadataKey, target, targetKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetMetadata(metadataKey, target, targetKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", C.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryGetOwnMetadata(metadataKey, target, targetKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(C.prototype, "method"); + * + */ + function getMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryMetadataKeys(target, targetKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(C); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(C.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + return OrdinaryOwnMetadataKeys(target, targetKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param targetKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class C { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", C); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", C, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", C.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, targetKey) { + if (!IsObject(target)) { + throw new TypeError(); + } + else if (!IsUndefined(targetKey)) { + targetKey = ToPropertyKey(targetKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#deletemetadata-metadatakey-p- + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + if (IsUndefined(metadataMap)) { + return false; + } + if (!metadataMap.delete(metadataKey)) { + return false; + } + if (metadataMap.size > 0) { + return true; + } + var targetMetadata = __Metadata__.get(target); + targetMetadata.delete(targetKey); + if (targetMetadata.size > 0) { + return true; + } + __Metadata__.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated)) { + if (!IsConstructor(decorated)) { + throw new TypeError(); + } + target = decorated; + } + } + return target; + } + function DecoratePropertyWithDescriptor(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated)) { + if (!IsObject(decorated)) { + throw new TypeError(); + } + descriptor = decorated; + } + } + return descriptor; + } + function DecoratePropertyWithoutDescriptor(decorators, target, propertyKey) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + decorator(target, propertyKey); + } + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#getorcreatemetadatamap--o-p-create- + function GetOrCreateMetadataMap(target, targetKey, create) { + var targetMetadata = __Metadata__.get(target); + if (!targetMetadata) { + if (!create) { + return undefined; + } + targetMetadata = new _Map(); + __Metadata__.set(target, targetMetadata); + } + var keyMetadata = targetMetadata.get(targetKey); + if (!keyMetadata) { + if (!create) { + return undefined; + } + keyMetadata = new _Map(); + targetMetadata.set(targetKey, keyMetadata); + } + return keyMetadata; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasmetadata--metadatakey-o-p- + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return true; + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryHasMetadata(MetadataKey, parent, P); + } + return false; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryhasownmetadata--metadatakey-o-p- + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return false; + } + return Boolean(metadataMap.has(MetadataKey)); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetmetadata--metadatakey-o-p- + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) { + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + var parent = GetPrototypeOf(O); + if (parent !== null) { + return OrdinaryGetMetadata(MetadataKey, parent, P); + } + return undefined; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarygetownmetadata--metadatakey-o-p- + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, false); + if (metadataMap === undefined) { + return undefined; + } + return metadataMap.get(MetadataKey); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarydefineownmetadata--metadatakey-metadatavalue-o-p- + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, true); + metadataMap.set(MetadataKey, MetadataValue); + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinarymetadatakeys--o-p- + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = GetPrototypeOf(O); + if (parent === null) { + return ownKeys; + } + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) { + return ownKeys; + } + if (ownKeys.length <= 0) { + return parentKeys; + } + var set = new _Set(); + var keys = []; + for (var _i = 0; _i < ownKeys.length; _i++) { + var key = ownKeys[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0; _a < parentKeys.length; _a++) { + var key = parentKeys[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // https://github.com/jonathandturner/decorators/blob/master/specs/metadata.md#ordinaryownmetadatakeys--o-p- + function OrdinaryOwnMetadataKeys(target, targetKey) { + var metadataMap = GetOrCreateMetadataMap(target, targetKey, false); + var keys = []; + if (metadataMap) { + metadataMap.forEach(function (_, key) { return keys.push(key); }); + } + return keys; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray + function IsArray(x) { + return Array.isArray(x); + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor + function IsConstructor(x) { + return typeof x === "function"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey + function ToPropertyKey(value) { + if (IsSymbol(value)) { + return value; + } + return String(value); + } + function GetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) { + return proto; + } + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) { + return proto; + } + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) { + return proto; + } + // if the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") { + return proto; + } + // if we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) { + return proto; + } + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + function Map() { + this._keys = []; + this._values = []; + this._cache = cacheSentinel; + } + Map.prototype = { + get size() { + return this._keys.length; + }, + has: function (key) { + if (key === this._cache) { + return true; + } + if (this._find(key) >= 0) { + this._cache = key; + return true; + } + return false; + }, + get: function (key) { + var index = this._find(key); + if (index >= 0) { + this._cache = key; + return this._values[index]; + } + return undefined; + }, + set: function (key, value) { + this.delete(key); + this._keys.push(key); + this._values.push(value); + this._cache = key; + return this; + }, + delete: function (key) { + var index = this._find(key); + if (index >= 0) { + this._keys.splice(index, 1); + this._values.splice(index, 1); + this._cache = cacheSentinel; + return true; + } + return false; + }, + clear: function () { + this._keys.length = 0; + this._values.length = 0; + this._cache = cacheSentinel; + }, + forEach: function (callback, thisArg) { + var size = this.size; + for (var i = 0; i < size; ++i) { + var key = this._keys[i]; + var value = this._values[i]; + this._cache = key; + callback.call(this, value, key, this); + } + }, + _find: function (key) { + var keys = this._keys; + var size = keys.length; + for (var i = 0; i < size; ++i) { + if (keys[i] === key) { + return i; + } + } + return -1; + } + }; + return Map; + } + // naive Set shim + function CreateSetPolyfill() { + var cacheSentinel = {}; + function Set() { + this._map = new _Map(); + } + Set.prototype = { + get size() { + return this._map.length; + }, + has: function (value) { + return this._map.has(value); + }, + add: function (value) { + this._map.set(value, value); + return this; + }, + delete: function (value) { + return this._map.delete(value); + }, + clear: function () { + this._map.clear(); + }, + forEach: function (callback, thisArg) { + this._map.forEach(callback, thisArg); + } + }; + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var isNode = typeof global !== "undefined" && Object.prototype.toString.call(global.process) === '[object process]'; + var nodeCrypto = isNode && require("crypto"); + var hasOwn = Object.prototype.hasOwnProperty; + var keys = {}; + var rootKey = CreateUniqueKey(); + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype = { + has: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return this._key in table; + } + return false; + }, + get: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table) { + return table[this._key]; + } + return undefined; + }, + set: function (target, value) { + var table = GetOrCreateWeakMapTable(target, true); + table[this._key] = value; + return this; + }, + delete: function (target) { + var table = GetOrCreateWeakMapTable(target, false); + if (table && this._key in table) { + return delete table[this._key]; + } + return false; + }, + clear: function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + } + }; + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) { + buffer[i] = Math.random() * 255 | 0; + } + } + function GenRandomBytes(size) { + if (nodeCrypto) { + var data = nodeCrypto.randomBytes(size); + return data; + } + else if (typeof Uint8Array === "function") { + var data = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(data); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(data); + } + else { + FillRandomBytes(data, size); + } + return data; + } + else { + var data = new Array(size); + FillRandomBytes(data, size); + return data; + } + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) { + result += "-"; + } + if (byte < 16) { + result += "0"; + } + result += byte.toString(16).toLowerCase(); + } + return result; + } + function CreateUniqueKey() { + var key; + do { + key = "@@WeakMap@@" + CreateUUID(); + } while (hasOwn.call(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) { + return undefined; + } + Object.defineProperty(target, rootKey, { value: Object.create(null) }); + } + return target[rootKey]; + } + return WeakMap; + } + // hook global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + __global.Reflect[p] = Reflect[p]; + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof window !== "undefined" ? window : + typeof WorkerGlobalScope !== "undefined" ? self : + typeof global !== "undefined" ? global : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURLDisabled=Reflect.js.map +"format register"; +System.register("angular2/lifecycle_hooks", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var globalScope; + if (typeof window === 'undefined') { + if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { + globalScope = self; + } else { + globalScope = global; + } + } else { + globalScope = window; + } + ; + 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 assertionsEnabled_ = typeof _global['assert'] !== 'undefined'; + function assertionsEnabled() { + return assertionsEnabled_; + } + exports.assertionsEnabled = assertionsEnabled; + _global.assert = function assert(condition) { + if (assertionsEnabled_) { + _global['assert'].call(condition); + } + }; + function CONST_EXPR(expr) { + return expr; + } + exports.CONST_EXPR = CONST_EXPR; + function CONST() { + return function(target) { + return target; + }; + } + exports.CONST = CONST; + function ABSTRACT() { + return function(t) { + return t; + }; + } + exports.ABSTRACT = ABSTRACT; + 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 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.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.toUpperCase = function(s) { + return s.toUpperCase(); + }; + StringWrapper.toLowerCase = function(s) { + return s.toLowerCase(); + }; + StringWrapper.startsWith = function(s, start) { + return s.startsWith(start); + }; + StringWrapper.substring = function(s, start, end) { + if (end === void 0) { + end = null; + } + return s.substring(start, end === null ? undefined : end); + }; + 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, message); + 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.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)) { + 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/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/core/facade/collection", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Map = lang_1.global.Map; + exports.Set = lang_1.global.Set; + exports.StringMap = lang_1.global.Object; + 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.forEach = function(m, fn) { + m.forEach(fn); + }; + MapWrapper.get = function(map, key) { + return map.get(key); + }; + MapWrapper.size = function(m) { + return m.size; + }; + MapWrapper.delete = function(m, k) { + m.delete(k); + }; + 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.map = function(array, fn) { + return array.map(fn); + }; + ListWrapper.forEach = function(array, fn) { + for (var i = 0; i < array.length; i++) { + fn(array[i]); + } + }; + 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.find = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return list[i]; + } + return null; + }; + ListWrapper.indexOf = function(array, value, startIndex) { + if (startIndex === void 0) { + startIndex = 0; + } + return array.indexOf(value, startIndex); + }; + ListWrapper.reduce = function(list, fn, init) { + return list.reduce(fn, init); + }; + ListWrapper.filter = function(array, pred) { + return array.filter(pred); + }; + ListWrapper.any = function(list, pred) { + for (var i = 0; i < list.length; ++i) { + if (pred(list[i])) + return true; + } + return false; + }; + 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.removeLast = function(list) { + return list.pop(); + }; + 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.join = function(list, s) { + return list.join(s); + }; + 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/core/facade/exception_handler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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 collection_1.ListWrapper.filter(allTypes, 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); + }; + Reflector.prototype.moduleId = function(type) { + return this.reflectionCapabilities.moduleId(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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + 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 = collection_1.ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = collection_1.ListWrapper.createFixedSize(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); + } + } + return collection_1.ListWrapper.createFixedSize(typeOrFunc.length); + }; + 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 './'; + }; + ReflectionCapabilities.prototype.moduleId = 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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 = collection_1.ListWrapper.map(reversed, function(k) { + return lang_1.stringify(k.token); + }); + return " (" + tokenStrs.join(' -> ') + ")"; + } else { + return ""; + } + } + var AbstractBindingError = (function(_super) { + __extends(AbstractBindingError, _super); + function AbstractBindingError(injector, key, constructResolvingMessage) { + _super.call(this, "DI Exception"); + this.keys = [key]; + this.injectors = [injector]; + this.constructResolvingMessage = constructResolvingMessage; + this.message = this.constructResolvingMessage(this.keys); + } + AbstractBindingError.prototype.addKey = function(injector, key) { + this.injectors.push(injector); + this.keys.push(key); + this.message = this.constructResolvingMessage(this.keys); + }; + Object.defineProperty(AbstractBindingError.prototype, "context", { + get: function() { + return this.injectors[this.injectors.length - 1].debugContext(); + }, + enumerable: true, + configurable: true + }); + return AbstractBindingError; + })(exceptions_1.BaseException); + exports.AbstractBindingError = AbstractBindingError; + var NoBindingError = (function(_super) { + __extends(NoBindingError, _super); + function NoBindingError(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 NoBindingError; + })(AbstractBindingError); + exports.NoBindingError = NoBindingError; + 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; + })(AbstractBindingError); + 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 InvalidBindingError = (function(_super) { + __extends(InvalidBindingError, _super); + function InvalidBindingError(binding) { + _super.call(this, "Invalid binding - only instances of Binding and Type are allowed, got: " + binding.toString()); + } + return InvalidBindingError; + })(exceptions_1.BaseException); + exports.InvalidBindingError = InvalidBindingError; + 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(collection_1.ListWrapper.map(parameter, 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 MixingMultiBindingsWithRegularBindings = (function(_super) { + __extends(MixingMultiBindingsWithRegularBindings, _super); + function MixingMultiBindingsWithRegularBindings(binding1, binding2) { + _super.call(this, "Cannot mix multi bindings and regular bindings, got: " + binding1.toString() + " " + binding2.toString()); + } + return MixingMultiBindingsWithRegularBindings; + })(exceptions_1.BaseException); + exports.MixingMultiBindingsWithRegularBindings = MixingMultiBindingsWithRegularBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/opaque_token", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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/core/change_detection/constants", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + (function(ChangeDetectionStrategy) { + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckOnce"] = 0] = "CheckOnce"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Checked"] = 1] = "Checked"; + ChangeDetectionStrategy[ChangeDetectionStrategy["CheckAlways"] = 2] = "CheckAlways"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Detached"] = 3] = "Detached"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 4] = "OnPush"; + ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 5] = "Default"; + ChangeDetectionStrategy[ChangeDetectionStrategy["OnPushObserve"] = 6] = "OnPushObserve"; + })(exports.ChangeDetectionStrategy || (exports.ChangeDetectionStrategy = {})); + var ChangeDetectionStrategy = exports.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = [ChangeDetectionStrategy.CheckOnce, ChangeDetectionStrategy.Checked, ChangeDetectionStrategy.CheckAlways, ChangeDetectionStrategy.Detached, ChangeDetectionStrategy.OnPush, ChangeDetectionStrategy.Default, ChangeDetectionStrategy.OnPushObserve]; + function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { + return lang_1.isBlank(changeDetectionStrategy) || changeDetectionStrategy === ChangeDetectionStrategy.Default; + } + exports.isDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipe_lifecycle_reflector", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function implementsOnDestroy(pipe) { + return pipe.constructor.prototype.onDestroy; + } + exports.implementsOnDestroy = implementsOnDestroy; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/binding_record", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DIRECTIVE_LIFECYCLE = "directiveLifecycle"; + var BINDING = "native"; + var DIRECTIVE = "directive"; + var ELEMENT_PROPERTY = "elementProperty"; + var ELEMENT_ATTRIBUTE = "elementAttribute"; + var ELEMENT_CLASS = "elementClass"; + var ELEMENT_STYLE = "elementStyle"; + var TEXT_NODE = "textNode"; + var EVENT = "event"; + var HOST_EVENT = "hostEvent"; + var BindingTarget = (function() { + function BindingTarget(mode, elementIndex, name, unit, debug) { + this.mode = mode; + this.elementIndex = elementIndex; + this.name = name; + this.unit = unit; + this.debug = debug; + } + BindingTarget.prototype.isDirective = function() { + return this.mode === DIRECTIVE; + }; + BindingTarget.prototype.isElementProperty = function() { + return this.mode === ELEMENT_PROPERTY; + }; + BindingTarget.prototype.isElementAttribute = function() { + return this.mode === ELEMENT_ATTRIBUTE; + }; + BindingTarget.prototype.isElementClass = function() { + return this.mode === ELEMENT_CLASS; + }; + BindingTarget.prototype.isElementStyle = function() { + return this.mode === ELEMENT_STYLE; + }; + BindingTarget.prototype.isTextNode = function() { + return this.mode === TEXT_NODE; + }; + return BindingTarget; + })(); + exports.BindingTarget = BindingTarget; + var BindingRecord = (function() { + function BindingRecord(mode, target, implicitReceiver, ast, setter, lifecycleEvent, directiveRecord) { + this.mode = mode; + this.target = target; + this.implicitReceiver = implicitReceiver; + this.ast = ast; + this.setter = setter; + this.lifecycleEvent = lifecycleEvent; + this.directiveRecord = directiveRecord; + } + BindingRecord.prototype.isDirectiveLifecycle = function() { + return this.mode === DIRECTIVE_LIFECYCLE; + }; + BindingRecord.prototype.callOnChanges = function() { + return lang_1.isPresent(this.directiveRecord) && this.directiveRecord.callOnChanges; + }; + BindingRecord.prototype.isDefaultChangeDetection = function() { + return lang_1.isBlank(this.directiveRecord) || this.directiveRecord.isDefaultChangeDetection(); + }; + BindingRecord.createDirectiveDoCheck = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "DoCheck", directiveRecord); + }; + BindingRecord.createDirectiveOnInit = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnInit", directiveRecord); + }; + BindingRecord.createDirectiveOnChanges = function(directiveRecord) { + return new BindingRecord(DIRECTIVE_LIFECYCLE, null, 0, null, null, "OnChanges", directiveRecord); + }; + BindingRecord.createForDirective = function(ast, propertyName, setter, directiveRecord) { + var elementIndex = directiveRecord.directiveIndex.elementIndex; + var t = new BindingTarget(DIRECTIVE, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(DIRECTIVE, t, 0, ast, setter, null, directiveRecord); + }; + BindingRecord.createForElementProperty = function(ast, elementIndex, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementAttribute = function(ast, elementIndex, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementClass = function(ast, elementIndex, className) { + var t = new BindingTarget(ELEMENT_CLASS, elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForElementStyle = function(ast, elementIndex, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostProperty = function(directiveIndex, ast, propertyName) { + var t = new BindingTarget(ELEMENT_PROPERTY, directiveIndex.elementIndex, propertyName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostAttribute = function(directiveIndex, ast, attributeName) { + var t = new BindingTarget(ELEMENT_ATTRIBUTE, directiveIndex.elementIndex, attributeName, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostClass = function(directiveIndex, ast, className) { + var t = new BindingTarget(ELEMENT_CLASS, directiveIndex.elementIndex, className, null, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForHostStyle = function(directiveIndex, ast, styleName, unit) { + var t = new BindingTarget(ELEMENT_STYLE, directiveIndex.elementIndex, styleName, unit, ast.toString()); + return new BindingRecord(BINDING, t, directiveIndex, ast, null, null, null); + }; + BindingRecord.createForTextNode = function(ast, elementIndex) { + var t = new BindingTarget(TEXT_NODE, elementIndex, null, null, ast.toString()); + return new BindingRecord(BINDING, t, 0, ast, null, null, null); + }; + BindingRecord.createForEvent = function(ast, eventName, elementIndex) { + var t = new BindingTarget(EVENT, elementIndex, eventName, null, ast.toString()); + return new BindingRecord(EVENT, t, 0, ast, null, null, null); + }; + BindingRecord.createForHostEvent = function(ast, eventName, directiveRecord) { + var directiveIndex = directiveRecord.directiveIndex; + var t = new BindingTarget(HOST_EVENT, directiveIndex.elementIndex, eventName, null, ast.toString()); + return new BindingRecord(HOST_EVENT, t, directiveIndex, ast, null, null, directiveRecord); + }; + return BindingRecord; + })(); + exports.BindingRecord = BindingRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/directive_record", ["angular2/src/core/facade/lang", "angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var DirectiveIndex = (function() { + function DirectiveIndex(elementIndex, directiveIndex) { + this.elementIndex = elementIndex; + this.directiveIndex = directiveIndex; + } + Object.defineProperty(DirectiveIndex.prototype, "name", { + get: function() { + return this.elementIndex + "_" + this.directiveIndex; + }, + enumerable: true, + configurable: true + }); + return DirectiveIndex; + })(); + exports.DirectiveIndex = DirectiveIndex; + var DirectiveRecord = (function() { + function DirectiveRecord(_a) { + var _b = _a === void 0 ? {} : _a, + directiveIndex = _b.directiveIndex, + callAfterContentInit = _b.callAfterContentInit, + callAfterContentChecked = _b.callAfterContentChecked, + callAfterViewInit = _b.callAfterViewInit, + callAfterViewChecked = _b.callAfterViewChecked, + callOnChanges = _b.callOnChanges, + callDoCheck = _b.callDoCheck, + callOnInit = _b.callOnInit, + changeDetection = _b.changeDetection; + this.directiveIndex = directiveIndex; + this.callAfterContentInit = lang_1.normalizeBool(callAfterContentInit); + this.callAfterContentChecked = lang_1.normalizeBool(callAfterContentChecked); + this.callOnChanges = lang_1.normalizeBool(callOnChanges); + this.callAfterViewInit = lang_1.normalizeBool(callAfterViewInit); + this.callAfterViewChecked = lang_1.normalizeBool(callAfterViewChecked); + this.callDoCheck = lang_1.normalizeBool(callDoCheck); + this.callOnInit = lang_1.normalizeBool(callOnInit); + this.changeDetection = changeDetection; + } + DirectiveRecord.prototype.isDefaultChangeDetection = function() { + return constants_1.isDefaultChangeDetectionStrategy(this.changeDetection); + }; + return DirectiveRecord; + })(); + exports.DirectiveRecord = DirectiveRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detector_ref", ["angular2/src/core/change_detection/constants"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var constants_1 = require("angular2/src/core/change_detection/constants"); + var ChangeDetectorRef = (function() { + function ChangeDetectorRef(_cd) { + this._cd = _cd; + } + ChangeDetectorRef.prototype.markForCheck = function() { + this._cd.markPathToRootAsCheckOnce(); + }; + ChangeDetectorRef.prototype.detach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.Detached; + }; + ChangeDetectorRef.prototype.detectChanges = function() { + this._cd.detectChanges(); + }; + ChangeDetectorRef.prototype.reattach = function() { + this._cd.mode = constants_1.ChangeDetectionStrategy.CheckAlways; + this.markForCheck(); + }; + return ChangeDetectorRef; + })(); + exports.ChangeDetectorRef = ChangeDetectorRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/exceptions", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ExpressionChangedAfterItHasBeenCheckedException = (function(_super) { + __extends(ExpressionChangedAfterItHasBeenCheckedException, _super); + function ExpressionChangedAfterItHasBeenCheckedException(exp, oldValue, currValue, context) { + _super.call(this, ("Expression '" + exp + "' has changed after it was checked. ") + ("Previous value: '" + oldValue + "'. Current value: '" + currValue + "'")); + } + return ExpressionChangedAfterItHasBeenCheckedException; + })(exceptions_1.BaseException); + exports.ExpressionChangedAfterItHasBeenCheckedException = ExpressionChangedAfterItHasBeenCheckedException; + var ChangeDetectionError = (function(_super) { + __extends(ChangeDetectionError, _super); + function ChangeDetectionError(exp, originalException, originalStack, context) { + _super.call(this, originalException + " in [" + exp + "]", originalException, originalStack, context); + this.location = exp; + } + return ChangeDetectionError; + })(exceptions_1.WrappedException); + exports.ChangeDetectionError = ChangeDetectionError; + var DehydratedException = (function(_super) { + __extends(DehydratedException, _super); + function DehydratedException() { + _super.call(this, 'Attempt to detect changes on a dehydrated detector.'); + } + return DehydratedException; + })(exceptions_1.BaseException); + exports.DehydratedException = DehydratedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/wtf_impl", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/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/change_detection/observable_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function isObservable(value) { + return false; + } + exports.isObservable = isObservable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_name_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _ALREADY_CHECKED_ACCESSOR = "alreadyChecked"; + var _CONTEXT_ACCESSOR = "context"; + var _PROP_BINDING_INDEX = "propertyBindingIndex"; + var _DIRECTIVES_ACCESSOR = "directiveIndices"; + var _DISPATCHER_ACCESSOR = "dispatcher"; + var _LOCALS_ACCESSOR = "locals"; + var _MODE_ACCESSOR = "mode"; + var _PIPES_ACCESSOR = "pipes"; + var _PROTOS_ACCESSOR = "protos"; + exports.CONTEXT_INDEX = 0; + var _FIELD_PREFIX = 'this.'; + var _whiteSpaceRegExp = lang_1.RegExpWrapper.create("\\W", "g"); + function sanitizeName(s) { + return lang_1.StringWrapper.replaceAll(s, _whiteSpaceRegExp, ''); + } + exports.sanitizeName = sanitizeName; + var CodegenNameUtil = (function() { + function CodegenNameUtil(_records, _eventBindings, _directiveRecords, _utilName) { + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._utilName = _utilName; + this._sanitizedNames = collection_1.ListWrapper.createFixedSize(this._records.length + 1); + this._sanitizedNames[exports.CONTEXT_INDEX] = _CONTEXT_ACCESSOR; + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + this._sanitizedNames[i + 1] = sanitizeName("" + this._records[i].name + i); + } + this._sanitizedEventNames = new collection_1.Map(); + for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) { + var eb = _eventBindings[ebIndex]; + var names = [_CONTEXT_ACCESSOR]; + for (var i = 0, + iLen = eb.records.length; i < iLen; ++i) { + names.push(sanitizeName("" + eb.records[i].name + i + "_" + ebIndex)); + } + this._sanitizedEventNames.set(eb, names); + } + } + CodegenNameUtil.prototype._addFieldPrefix = function(name) { + return "" + _FIELD_PREFIX + name; + }; + CodegenNameUtil.prototype.getDispatcherName = function() { + return this._addFieldPrefix(_DISPATCHER_ACCESSOR); + }; + CodegenNameUtil.prototype.getPipesAccessorName = function() { + return this._addFieldPrefix(_PIPES_ACCESSOR); + }; + CodegenNameUtil.prototype.getProtosName = function() { + return this._addFieldPrefix(_PROTOS_ACCESSOR); + }; + CodegenNameUtil.prototype.getDirectivesAccessorName = function() { + return this._addFieldPrefix(_DIRECTIVES_ACCESSOR); + }; + CodegenNameUtil.prototype.getLocalsAccessorName = function() { + return this._addFieldPrefix(_LOCALS_ACCESSOR); + }; + CodegenNameUtil.prototype.getAlreadyCheckedName = function() { + return this._addFieldPrefix(_ALREADY_CHECKED_ACCESSOR); + }; + CodegenNameUtil.prototype.getModeName = function() { + return this._addFieldPrefix(_MODE_ACCESSOR); + }; + CodegenNameUtil.prototype.getPropertyBindingIndex = function() { + return this._addFieldPrefix(_PROP_BINDING_INDEX); + }; + CodegenNameUtil.prototype.getLocalName = function(idx) { + return "l_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.getEventLocalName = function(eb, idx) { + return "l_" + collection_1.MapWrapper.get(this._sanitizedEventNames, eb)[idx]; + }; + CodegenNameUtil.prototype.getChangeName = function(idx) { + return "c_" + this._sanitizedNames[idx]; + }; + CodegenNameUtil.prototype.genInitLocals = function() { + var declarations = []; + var assignments = []; + for (var i = 0, + iLen = this.getFieldCount(); i < iLen; ++i) { + if (i == exports.CONTEXT_INDEX) { + declarations.push(this.getLocalName(i) + " = " + this.getFieldName(i)); + } else { + var rec = this._records[i - 1]; + if (rec.argumentToPureFunction) { + var changeName = this.getChangeName(i); + declarations.push(this.getLocalName(i) + "," + changeName); + assignments.push(changeName); + } else { + declarations.push("" + this.getLocalName(i)); + } + } + } + var assignmentsCode = collection_1.ListWrapper.isEmpty(assignments) ? '' : collection_1.ListWrapper.join(assignments, '=') + " = false;"; + return "var " + collection_1.ListWrapper.join(declarations, ',') + ";" + assignmentsCode; + }; + CodegenNameUtil.prototype.genInitEventLocals = function() { + var _this = this; + var res = [(this.getLocalName(exports.CONTEXT_INDEX) + " = " + this.getFieldName(exports.CONTEXT_INDEX))]; + collection_1.MapWrapper.forEach(this._sanitizedEventNames, function(names, eb) { + for (var i = 0; i < names.length; ++i) { + if (i !== exports.CONTEXT_INDEX) { + res.push("" + _this.getEventLocalName(eb, i)); + } + } + }); + return res.length > 1 ? "var " + res.join(',') + ";" : ''; + }; + CodegenNameUtil.prototype.getPreventDefaultAccesor = function() { + return "preventDefault"; + }; + CodegenNameUtil.prototype.getFieldCount = function() { + return this._sanitizedNames.length; + }; + CodegenNameUtil.prototype.getFieldName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx]); + }; + CodegenNameUtil.prototype.getAllFieldNames = function() { + var fieldList = []; + for (var k = 0, + kLen = this.getFieldCount(); k < kLen; ++k) { + if (k === 0 || this._records[k - 1].shouldBeChecked()) { + fieldList.push(this.getFieldName(k)); + } + } + for (var i = 0, + iLen = this._records.length; i < iLen; ++i) { + var rec = this._records[i]; + if (rec.isPipeRecord()) { + fieldList.push(this.getPipeName(rec.selfIndex)); + } + } + for (var j = 0, + jLen = this._directiveRecords.length; j < jLen; ++j) { + var dRec = this._directiveRecords[j]; + fieldList.push(this.getDirectiveName(dRec.directiveIndex)); + if (!dRec.isDefaultChangeDetection()) { + fieldList.push(this.getDetectorName(dRec.directiveIndex)); + } + } + return fieldList; + }; + CodegenNameUtil.prototype.genDehydrateFields = function() { + var fields = this.getAllFieldNames(); + collection_1.ListWrapper.removeAt(fields, exports.CONTEXT_INDEX); + if (collection_1.ListWrapper.isEmpty(fields)) + return ''; + fields.push(this._utilName + ".uninitialized;"); + return collection_1.ListWrapper.join(fields, ' = '); + }; + CodegenNameUtil.prototype.genPipeOnDestroy = function() { + var _this = this; + return collection_1.ListWrapper.join(collection_1.ListWrapper.map(collection_1.ListWrapper.filter(this._records, function(r) { + return r.isPipeRecord(); + }), function(r) { + return _this._utilName + ".callPipeOnDestroy(" + _this.getPipeName(r.selfIndex) + ");"; + }), '\n'); + }; + CodegenNameUtil.prototype.getPipeName = function(idx) { + return this._addFieldPrefix(this._sanitizedNames[idx] + "_pipe"); + }; + CodegenNameUtil.prototype.getDirectiveName = function(d) { + return this._addFieldPrefix("directive_" + d.name); + }; + CodegenNameUtil.prototype.getDetectorName = function(d) { + return this._addFieldPrefix("detector_" + d.name); + }; + return CodegenNameUtil; + })(); + exports.CodegenNameUtil = CodegenNameUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_facade", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function codify(obj) { + return JSON.stringify(obj); + } + exports.codify = codify; + function rawString(str) { + return "'" + str + "'"; + } + exports.rawString = rawString; + function combineGeneratedStrings(vals) { + return vals.join(' + '); + } + exports.combineGeneratedStrings = combineGeneratedStrings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_record", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(RecordType) { + RecordType[RecordType["Self"] = 0] = "Self"; + RecordType[RecordType["Const"] = 1] = "Const"; + RecordType[RecordType["PrimitiveOp"] = 2] = "PrimitiveOp"; + RecordType[RecordType["PropertyRead"] = 3] = "PropertyRead"; + RecordType[RecordType["PropertyWrite"] = 4] = "PropertyWrite"; + RecordType[RecordType["Local"] = 5] = "Local"; + RecordType[RecordType["InvokeMethod"] = 6] = "InvokeMethod"; + RecordType[RecordType["InvokeClosure"] = 7] = "InvokeClosure"; + RecordType[RecordType["KeyedRead"] = 8] = "KeyedRead"; + RecordType[RecordType["KeyedWrite"] = 9] = "KeyedWrite"; + RecordType[RecordType["Pipe"] = 10] = "Pipe"; + RecordType[RecordType["Interpolate"] = 11] = "Interpolate"; + RecordType[RecordType["SafeProperty"] = 12] = "SafeProperty"; + RecordType[RecordType["CollectionLiteral"] = 13] = "CollectionLiteral"; + RecordType[RecordType["SafeMethodInvoke"] = 14] = "SafeMethodInvoke"; + RecordType[RecordType["DirectiveLifecycle"] = 15] = "DirectiveLifecycle"; + RecordType[RecordType["Chain"] = 16] = "Chain"; + })(exports.RecordType || (exports.RecordType = {})); + var RecordType = exports.RecordType; + var ProtoRecord = (function() { + function ProtoRecord(mode, name, funcOrValue, args, fixedArgs, contextIndex, directiveIndex, selfIndex, bindingRecord, lastInBinding, lastInDirective, argumentToPureFunction, referencedBySelf, propertyBindingIndex) { + this.mode = mode; + this.name = name; + this.funcOrValue = funcOrValue; + this.args = args; + this.fixedArgs = fixedArgs; + this.contextIndex = contextIndex; + this.directiveIndex = directiveIndex; + this.selfIndex = selfIndex; + this.bindingRecord = bindingRecord; + this.lastInBinding = lastInBinding; + this.lastInDirective = lastInDirective; + this.argumentToPureFunction = argumentToPureFunction; + this.referencedBySelf = referencedBySelf; + this.propertyBindingIndex = propertyBindingIndex; + } + ProtoRecord.prototype.isPureFunction = function() { + return this.mode === RecordType.Interpolate || this.mode === RecordType.CollectionLiteral; + }; + ProtoRecord.prototype.isUsedByOtherRecord = function() { + return !this.lastInBinding || this.referencedBySelf; + }; + ProtoRecord.prototype.shouldBeChecked = function() { + return this.argumentToPureFunction || this.lastInBinding || this.isPureFunction() || this.isPipeRecord(); + }; + ProtoRecord.prototype.isPipeRecord = function() { + return this.mode === RecordType.Pipe; + }; + ProtoRecord.prototype.isLifeCycleRecord = function() { + return this.mode === RecordType.DirectiveLifecycle; + }; + return ProtoRecord; + })(); + exports.ProtoRecord = ProtoRecord; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/ast", ["angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/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 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 If = (function(_super) { + __extends(If, _super); + function If(condition, trueExp, falseExp) { + _super.call(this); + this.condition = condition; + this.trueExp = trueExp; + this.falseExp = falseExp; + } + If.prototype.visit = function(visitor) { + return visitor.visitIf(this); + }; + return If; + })(AST); + exports.If = If; + 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) { + __extends(LiteralMap, _super); + function LiteralMap(keys, values) { + _super.call(this); + this.keys = keys; + this.values = values; + } + LiteralMap.prototype.visit = function(visitor) { + return visitor.visitLiteralMap(this); + }; + return LiteralMap; + })(AST); + exports.LiteralMap = LiteralMap; + var Interpolation = (function(_super) { + __extends(Interpolation, _super); + function Interpolation(strings, expressions) { + _super.call(this); + this.strings = strings; + this.expressions = expressions; + } + Interpolation.prototype.visit = function(visitor) { + visitor.visitInterpolation(this); + }; + return Interpolation; + })(AST); + exports.Interpolation = Interpolation; + var Binary = (function(_super) { + __extends(Binary, _super); + function Binary(operation, left, right) { + _super.call(this); + this.operation = operation; + this.left = left; + this.right = right; + } + Binary.prototype.visit = function(visitor) { + return visitor.visitBinary(this); + }; + return Binary; + })(AST); + exports.Binary = Binary; + var PrefixNot = (function(_super) { + __extends(PrefixNot, _super); + function PrefixNot(expression) { + _super.call(this); + this.expression = expression; + } + PrefixNot.prototype.visit = function(visitor) { + return visitor.visitPrefixNot(this); + }; + return PrefixNot; + })(AST); + exports.PrefixNot = PrefixNot; + var MethodCall = (function(_super) { + __extends(MethodCall, _super); + function MethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + MethodCall.prototype.visit = function(visitor) { + return visitor.visitMethodCall(this); + }; + return MethodCall; + })(AST); + exports.MethodCall = MethodCall; + var SafeMethodCall = (function(_super) { + __extends(SafeMethodCall, _super); + function SafeMethodCall(receiver, name, fn, args) { + _super.call(this); + this.receiver = receiver; + this.name = name; + this.fn = fn; + this.args = args; + } + SafeMethodCall.prototype.visit = function(visitor) { + return visitor.visitSafeMethodCall(this); + }; + return SafeMethodCall; + })(AST); + exports.SafeMethodCall = SafeMethodCall; + var FunctionCall = (function(_super) { + __extends(FunctionCall, _super); + function FunctionCall(target, args) { + _super.call(this); + this.target = target; + this.args = args; + } + FunctionCall.prototype.visit = function(visitor) { + return visitor.visitFunctionCall(this); + }; + return FunctionCall; + })(AST); + exports.FunctionCall = FunctionCall; + var ASTWithSource = (function(_super) { + __extends(ASTWithSource, _super); + function ASTWithSource(ast, source, location) { + _super.call(this); + this.ast = ast; + this.source = source; + this.location = location; + } + ASTWithSource.prototype.visit = function(visitor) { + return this.ast.visit(visitor); + }; + ASTWithSource.prototype.toString = function() { + return this.source + " in " + this.location; + }; + return ASTWithSource; + })(AST); + exports.ASTWithSource = ASTWithSource; + var TemplateBinding = (function() { + function TemplateBinding(key, keyIsVar, name, expression) { + this.key = key; + this.keyIsVar = keyIsVar; + this.name = name; + this.expression = expression; + } + return TemplateBinding; + })(); + exports.TemplateBinding = TemplateBinding; + var RecursiveAstVisitor = (function() { + function RecursiveAstVisitor() {} + RecursiveAstVisitor.prototype.visitBinary = function(ast) { + ast.left.visit(this); + ast.right.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitChain = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitConditional = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitIf = function(ast) { + ast.condition.visit(this); + ast.trueExp.visit(this); + ast.falseExp.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPipe = function(ast) { + ast.exp.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitFunctionCall = function(ast) { + ast.target.visit(this); + this.visitAll(ast.args); + return null; + }; + RecursiveAstVisitor.prototype.visitImplicitReceiver = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitInterpolation = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitKeyedRead = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitKeyedWrite = function(ast) { + ast.obj.visit(this); + ast.key.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitLiteralArray = function(ast) { + return this.visitAll(ast.expressions); + }; + RecursiveAstVisitor.prototype.visitLiteralMap = function(ast) { + return this.visitAll(ast.values); + }; + RecursiveAstVisitor.prototype.visitLiteralPrimitive = function(ast) { + return null; + }; + RecursiveAstVisitor.prototype.visitMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitPrefixNot = function(ast) { + ast.expression.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitPropertyWrite = function(ast) { + ast.receiver.visit(this); + ast.value.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafePropertyRead = function(ast) { + ast.receiver.visit(this); + return null; + }; + RecursiveAstVisitor.prototype.visitSafeMethodCall = function(ast) { + ast.receiver.visit(this); + return this.visitAll(ast.args); + }; + RecursiveAstVisitor.prototype.visitAll = function(asts) { + var _this = this; + collection_1.ListWrapper.forEach(asts, function(ast) { + ast.visit(_this); + }); + return null; + }; + return RecursiveAstVisitor; + })(); + exports.RecursiveAstVisitor = RecursiveAstVisitor; + var AstTransformer = (function() { + function AstTransformer() {} + AstTransformer.prototype.visitImplicitReceiver = function(ast) { + return ast; + }; + AstTransformer.prototype.visitInterpolation = function(ast) { + return new Interpolation(ast.strings, this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralPrimitive = function(ast) { + return new LiteralPrimitive(ast.value); + }; + AstTransformer.prototype.visitPropertyRead = function(ast) { + return new PropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitPropertyWrite = function(ast) { + return new PropertyWrite(ast.receiver.visit(this), ast.name, ast.setter, ast.value); + }; + AstTransformer.prototype.visitSafePropertyRead = function(ast) { + return new SafePropertyRead(ast.receiver.visit(this), ast.name, ast.getter); + }; + AstTransformer.prototype.visitMethodCall = function(ast) { + return new MethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitSafeMethodCall = function(ast) { + return new SafeMethodCall(ast.receiver.visit(this), ast.name, ast.fn, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitFunctionCall = function(ast) { + return new FunctionCall(ast.target.visit(this), this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitLiteralArray = function(ast) { + return new LiteralArray(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitLiteralMap = function(ast) { + return new LiteralMap(ast.keys, this.visitAll(ast.values)); + }; + AstTransformer.prototype.visitBinary = function(ast) { + return new Binary(ast.operation, ast.left.visit(this), ast.right.visit(this)); + }; + AstTransformer.prototype.visitPrefixNot = function(ast) { + return new PrefixNot(ast.expression.visit(this)); + }; + AstTransformer.prototype.visitConditional = function(ast) { + return new Conditional(ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); + }; + AstTransformer.prototype.visitPipe = function(ast) { + return new BindingPipe(ast.exp.visit(this), ast.name, this.visitAll(ast.args)); + }; + AstTransformer.prototype.visitKeyedRead = function(ast) { + return new KeyedRead(ast.obj.visit(this), ast.key.visit(this)); + }; + AstTransformer.prototype.visitKeyedWrite = function(ast) { + return new KeyedWrite(ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); + }; + AstTransformer.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + AstTransformer.prototype.visitChain = function(ast) { + return new Chain(this.visitAll(ast.expressions)); + }; + AstTransformer.prototype.visitIf = function(ast) { + var falseExp = lang_1.isPresent(ast.falseExp) ? ast.falseExp.visit(this) : null; + return new If(ast.condition.visit(this), ast.trueExp.visit(this), falseExp); + }; + return AstTransformer; + })(); + exports.AstTransformer = AstTransformer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/dynamic_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_record"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicChangeDetector = (function(_super) { + __extends(DynamicChangeDetector, _super); + function DynamicChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy, _records, _eventBindings, _directiveRecords, _genConfig) { + _super.call(this, id, dispatcher, numberOfPropertyProtoRecords, propertyBindingTargets, directiveIndices, strategy); + this._records = _records; + this._eventBindings = _eventBindings; + this._directiveRecords = _directiveRecords; + this._genConfig = _genConfig; + this.directives = null; + var len = _records.length + 1; + this.values = collection_1.ListWrapper.createFixedSize(len); + this.localPipes = collection_1.ListWrapper.createFixedSize(len); + this.prevContexts = collection_1.ListWrapper.createFixedSize(len); + this.changes = collection_1.ListWrapper.createFixedSize(len); + this.dehydrateDirectives(false); + } + DynamicChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + var _this = this; + var preventDefault = false; + this._matchingEventBindings(eventName, elIndex).forEach(function(rec) { + var res = _this._processEventBinding(rec, locals); + if (res === false) { + preventDefault = true; + } + }); + return preventDefault; + }; + DynamicChangeDetector.prototype._processEventBinding = function(eb, locals) { + var values = collection_1.ListWrapper.createFixedSize(eb.records.length); + values[0] = this.values[0]; + for (var i = 0; i < eb.records.length; ++i) { + var proto = eb.records[i]; + var res = this._calculateCurrValue(proto, values, locals); + if (proto.lastInBinding) { + this._markPathAsCheckOnce(proto); + return res; + } else { + this._writeSelf(proto, res, values); + } + } + throw new exceptions_1.BaseException("Cannot be reached"); + }; + DynamicChangeDetector.prototype._markPathAsCheckOnce = function(proto) { + if (!proto.bindingRecord.isDefaultChangeDetection()) { + var dir = proto.bindingRecord.directiveRecord; + this._getDetectorFor(dir.directiveIndex).markPathToRootAsCheckOnce(); + } + }; + DynamicChangeDetector.prototype._matchingEventBindings = function(eventName, elIndex) { + return collection_1.ListWrapper.filter(this._eventBindings, function(eb) { + return eb.eventName == eventName && eb.elIndex === elIndex; + }); + }; + DynamicChangeDetector.prototype.hydrateDirectives = function(directives) { + this.values[0] = this.context; + this.directives = directives; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + for (var i = 0; i < this.directiveIndices.length; ++i) { + var index = this.directiveIndices[i]; + _super.prototype.observeDirective.call(this, directives.getDirectiveFor(index), i); + } + } + }; + DynamicChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) { + if (destroyPipes) { + this._destroyPipes(); + } + this.values[0] = null; + this.directives = null; + collection_1.ListWrapper.fill(this.values, change_detection_util_1.ChangeDetectionUtil.uninitialized, 1); + collection_1.ListWrapper.fill(this.changes, false); + collection_1.ListWrapper.fill(this.localPipes, null); + collection_1.ListWrapper.fill(this.prevContexts, change_detection_util_1.ChangeDetectionUtil.uninitialized); + }; + DynamicChangeDetector.prototype._destroyPipes = function() { + for (var i = 0; i < this.localPipes.length; ++i) { + if (lang_1.isPresent(this.localPipes[i])) { + change_detection_util_1.ChangeDetectionUtil.callPipeOnDestroy(this.localPipes[i]); + } + } + }; + DynamicChangeDetector.prototype.checkNoChanges = function() { + this.runDetectChanges(true); + }; + DynamicChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) { + var protos = this._records; + var changes = null; + var isChanged = false; + for (var i = 0; i < protos.length; ++i) { + var proto = protos[i]; + var bindingRecord = proto.bindingRecord; + var directiveRecord = bindingRecord.directiveRecord; + if (this._firstInBinding(proto)) { + this.propertyBindingIndex = proto.propertyBindingIndex; + } + if (proto.isLifeCycleRecord()) { + if (proto.name === "DoCheck" && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).doCheck(); + } else if (proto.name === "OnInit" && !throwOnChange && !this.alreadyChecked) { + this._getDirectiveFor(directiveRecord.directiveIndex).onInit(); + } else if (proto.name === "OnChanges" && lang_1.isPresent(changes) && !throwOnChange) { + this._getDirectiveFor(directiveRecord.directiveIndex).onChanges(changes); + } + } else { + var change = this._check(proto, throwOnChange, this.values, this.locals); + if (lang_1.isPresent(change)) { + this._updateDirectiveOrElement(change, bindingRecord); + isChanged = true; + changes = this._addChange(bindingRecord, change, changes); + } + } + if (proto.lastInDirective) { + changes = null; + if (isChanged && !bindingRecord.isDefaultChangeDetection()) { + this._getDetectorFor(directiveRecord.directiveIndex).markAsCheckOnce(); + } + isChanged = false; + } + } + }; + DynamicChangeDetector.prototype._firstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this._records, r.selfIndex - 1); + return lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + }; + DynamicChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterContentInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentInit(); + } + if (dir.callAfterContentChecked) { + this._getDirectiveFor(dir.directiveIndex).afterContentChecked(); + } + } + }; + DynamicChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() { + var dirs = this._directiveRecords; + for (var i = dirs.length - 1; i >= 0; --i) { + var dir = dirs[i]; + if (dir.callAfterViewInit && !this.alreadyChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewInit(); + } + if (dir.callAfterViewChecked) { + this._getDirectiveFor(dir.directiveIndex).afterViewChecked(); + } + } + }; + DynamicChangeDetector.prototype._updateDirectiveOrElement = function(change, bindingRecord) { + if (lang_1.isBlank(bindingRecord.directiveRecord)) { + _super.prototype.notifyDispatcher.call(this, change.currentValue); + } else { + var directiveIndex = bindingRecord.directiveRecord.directiveIndex; + bindingRecord.setter(this._getDirectiveFor(directiveIndex), change.currentValue); + } + if (this._genConfig.logBindingUpdate) { + _super.prototype.logBindingUpdate.call(this, change.currentValue); + } + }; + DynamicChangeDetector.prototype._addChange = function(bindingRecord, change, changes) { + if (bindingRecord.callOnChanges()) { + return _super.prototype.addChange.call(this, changes, change.previousValue, change.currentValue); + } else { + return changes; + } + }; + DynamicChangeDetector.prototype._getDirectiveFor = function(directiveIndex) { + return this.directives.getDirectiveFor(directiveIndex); + }; + DynamicChangeDetector.prototype._getDetectorFor = function(directiveIndex) { + return this.directives.getDetectorFor(directiveIndex); + }; + DynamicChangeDetector.prototype._check = function(proto, throwOnChange, values, locals) { + if (proto.isPipeRecord()) { + return this._pipeCheck(proto, throwOnChange, values); + } else { + return this._referenceCheck(proto, throwOnChange, values, locals); + } + }; + DynamicChangeDetector.prototype._referenceCheck = function(proto, throwOnChange, values, locals) { + if (this._pureFuncAndArgsDidNotChange(proto)) { + this._setChanged(proto, false); + return null; + } + var currValue = this._calculateCurrValue(proto, values, locals); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + _super.prototype.observeValue.call(this, currValue, proto.selfIndex); + } + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + }; + DynamicChangeDetector.prototype._calculateCurrValue = function(proto, values, locals) { + switch (proto.mode) { + case proto_record_1.RecordType.Self: + return this._readContext(proto, values); + case proto_record_1.RecordType.Const: + return proto.funcOrValue; + case proto_record_1.RecordType.PropertyRead: + var context = this._readContext(proto, values); + return proto.funcOrValue(context); + case proto_record_1.RecordType.SafeProperty: + var context = this._readContext(proto, values); + return lang_1.isBlank(context) ? null : proto.funcOrValue(context); + case proto_record_1.RecordType.PropertyWrite: + var context = this._readContext(proto, values); + var value = this._readArgs(proto, values)[0]; + proto.funcOrValue(context, value); + return value; + case proto_record_1.RecordType.KeyedWrite: + var context = this._readContext(proto, values); + var key = this._readArgs(proto, values)[0]; + var value = this._readArgs(proto, values)[1]; + context[key] = value; + return value; + case proto_record_1.RecordType.Local: + return locals.get(proto.name); + case proto_record_1.RecordType.InvokeMethod: + var context = this._readContext(proto, values); + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.SafeMethodInvoke: + var context = this._readContext(proto, values); + if (lang_1.isBlank(context)) { + return null; + } + var args = this._readArgs(proto, values); + return proto.funcOrValue(context, args); + case proto_record_1.RecordType.KeyedRead: + var arg = this._readArgs(proto, values)[0]; + return this._readContext(proto, values)[arg]; + case proto_record_1.RecordType.Chain: + var args = this._readArgs(proto, values); + return args[args.length - 1]; + case proto_record_1.RecordType.InvokeClosure: + return lang_1.FunctionWrapper.apply(this._readContext(proto, values), this._readArgs(proto, values)); + case proto_record_1.RecordType.Interpolate: + case proto_record_1.RecordType.PrimitiveOp: + case proto_record_1.RecordType.CollectionLiteral: + return lang_1.FunctionWrapper.apply(proto.funcOrValue, this._readArgs(proto, values)); + default: + throw new exceptions_1.BaseException("Unknown operation " + proto.mode); + } + }; + DynamicChangeDetector.prototype._pipeCheck = function(proto, throwOnChange, values) { + var context = this._readContext(proto, values); + var selectedPipe = this._pipeFor(proto, context); + if (!selectedPipe.pure || this._argsOrContextChanged(proto)) { + var args = this._readArgs(proto, values); + var currValue = selectedPipe.pipe.transform(context, args); + if (proto.shouldBeChecked()) { + var prevValue = this._readSelf(proto, values); + if (!isSame(prevValue, currValue)) { + currValue = change_detection_util_1.ChangeDetectionUtil.unwrapValue(currValue); + if (proto.lastInBinding) { + var change = change_detection_util_1.ChangeDetectionUtil.simpleChange(prevValue, currValue); + if (throwOnChange) + this.throwOnChangeError(prevValue, currValue); + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return change; + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } else { + this._setChanged(proto, false); + return null; + } + } else { + this._writeSelf(proto, currValue, values); + this._setChanged(proto, true); + return null; + } + } + }; + DynamicChangeDetector.prototype._pipeFor = function(proto, context) { + var storedPipe = this._readPipe(proto); + if (lang_1.isPresent(storedPipe)) + return storedPipe; + var pipe = this.pipes.get(proto.name); + this._writePipe(proto, pipe); + return pipe; + }; + DynamicChangeDetector.prototype._readContext = function(proto, values) { + if (proto.contextIndex == -1) { + return this._getDirectiveFor(proto.directiveIndex); + } else { + return values[proto.contextIndex]; + } + return values[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readSelf = function(proto, values) { + return values[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writeSelf = function(proto, value, values) { + values[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._readPipe = function(proto) { + return this.localPipes[proto.selfIndex]; + }; + DynamicChangeDetector.prototype._writePipe = function(proto, value) { + this.localPipes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._setChanged = function(proto, value) { + if (proto.argumentToPureFunction) + this.changes[proto.selfIndex] = value; + }; + DynamicChangeDetector.prototype._pureFuncAndArgsDidNotChange = function(proto) { + return proto.isPureFunction() && !this._argsChanged(proto); + }; + DynamicChangeDetector.prototype._argsChanged = function(proto) { + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + if (this.changes[args[i]]) { + return true; + } + } + return false; + }; + DynamicChangeDetector.prototype._argsOrContextChanged = function(proto) { + return this._argsChanged(proto) || this.changes[proto.contextIndex]; + }; + DynamicChangeDetector.prototype._readArgs = function(proto, values) { + var res = collection_1.ListWrapper.createFixedSize(proto.args.length); + var args = proto.args; + for (var i = 0; i < args.length; ++i) { + res[i] = values[args[i]]; + } + return res; + }; + return DynamicChangeDetector; + })(abstract_change_detector_1.AbstractChangeDetector); + exports.DynamicChangeDetector = DynamicChangeDetector; + function isSame(a, b) { + if (a === b) + return true; + if (a instanceof String && b instanceof String && a == b) + return true; + if ((a !== a) && (b !== b)) + return true; + return false; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/event_binding", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var EventBinding = (function() { + function EventBinding(eventName, elIndex, dirIndex, records) { + this.eventName = eventName; + this.elIndex = elIndex; + this.dirIndex = dirIndex; + this.records = records; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/coalesce", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + function coalesce(records) { + var res = []; + var indexMap = new collection_1.Map(); + for (var i = 0; i < records.length; ++i) { + var r = records[i]; + var record = _replaceIndices(r, res.length + 1, indexMap); + var matchingRecord = _findMatching(record, res); + if (lang_1.isPresent(matchingRecord) && record.lastInBinding) { + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + matchingRecord.referencedBySelf = true; + } else if (lang_1.isPresent(matchingRecord) && !record.lastInBinding) { + if (record.argumentToPureFunction) { + matchingRecord.argumentToPureFunction = true; + } + indexMap.set(r.selfIndex, matchingRecord.selfIndex); + } else { + res.push(record); + indexMap.set(r.selfIndex, record.selfIndex); + } + } + return res; + } + exports.coalesce = coalesce; + function _selfRecord(r, contextIndex, selfIndex) { + return new proto_record_1.ProtoRecord(proto_record_1.RecordType.Self, "self", null, [], r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, false, false, r.propertyBindingIndex); + } + function _findMatching(r, rs) { + return collection_1.ListWrapper.find(rs, function(rr) { + return rr.mode !== proto_record_1.RecordType.DirectiveLifecycle && _sameDirIndex(rr, r) && rr.mode === r.mode && lang_1.looseIdentical(rr.funcOrValue, r.funcOrValue) && rr.contextIndex === r.contextIndex && lang_1.looseIdentical(rr.name, r.name) && collection_1.ListWrapper.equals(rr.args, r.args); + }); + } + function _sameDirIndex(a, b) { + var di1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.directiveIndex; + var ei1 = lang_1.isBlank(a.directiveIndex) ? null : a.directiveIndex.elementIndex; + var di2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.directiveIndex; + var ei2 = lang_1.isBlank(b.directiveIndex) ? null : b.directiveIndex.elementIndex; + return di1 === di2 && ei1 === ei2; + } + function _replaceIndices(r, selfIndex, indexMap) { + var args = collection_1.ListWrapper.map(r.args, function(a) { + return _map(indexMap, a); + }); + var contextIndex = _map(indexMap, r.contextIndex); + return new proto_record_1.ProtoRecord(r.mode, r.name, r.funcOrValue, args, r.fixedArgs, contextIndex, r.directiveIndex, selfIndex, r.bindingRecord, r.lastInBinding, r.lastInDirective, r.argumentToPureFunction, r.referencedBySelf, r.propertyBindingIndex); + } + function _map(indexMap, value) { + var r = indexMap.get(value); + return lang_1.isPresent(r) ? r : value; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pregen_proto_change_detector", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var PregenProtoChangeDetector = (function() { + function PregenProtoChangeDetector() {} + PregenProtoChangeDetector.isSupported = function() { + return false; + }; + PregenProtoChangeDetector.prototype.instantiate = function(dispatcher) { + throw new exceptions_1.BaseException('Pregen change detection not supported in Js'); + }; + return PregenProtoChangeDetector; + })(); + exports.PregenProtoChangeDetector = PregenProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/differs/iterable_differs", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(IterableDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_2 = require("angular2/src/core/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)) { + collection_1.MapWrapper.delete(this.map, key); + } + return record; + }; + Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { + get: function() { + return collection_1.MapWrapper.size(this.map) === 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/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/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.Binding(KeyValueDiffers, { + toFactory: 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 = collection_1.ListWrapper.find(this.factories, 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/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/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; + collection_1.MapWrapper.delete(this._records, 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) { + collection_1.MapWrapper.forEach(obj, 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/interfaces", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var ChangeDetection = (function() { + function ChangeDetection() {} + ChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return null; + }; + Object.defineProperty(ChangeDetection.prototype, "generateDetectors", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ChangeDetection.prototype, "genConfig", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + ChangeDetection = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], ChangeDetection); + return ChangeDetection; + })(); + exports.ChangeDetection = ChangeDetection; + var DebugContext = (function() { + function DebugContext(element, componentElement, directive, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.directive = directive; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return DebugContext; + })(); + exports.DebugContext = DebugContext; + var ChangeDetectorGenConfig = (function() { + function ChangeDetectorGenConfig(genCheckNoChanges, genDebugInfo, logBindingUpdate, useJit) { + this.genCheckNoChanges = genCheckNoChanges; + this.genDebugInfo = genDebugInfo; + this.logBindingUpdate = logBindingUpdate; + this.useJit = useJit; + } + return ChangeDetectorGenConfig; + })(); + exports.ChangeDetectorGenConfig = ChangeDetectorGenConfig; + var ChangeDetectorDefinition = (function() { + function ChangeDetectorDefinition(id, strategy, variableNames, bindingRecords, eventRecords, directiveRecords, genConfig) { + this.id = id; + this.strategy = strategy; + this.variableNames = variableNames; + this.bindingRecords = bindingRecords; + this.eventRecords = eventRecords; + this.directiveRecords = directiveRecords; + this.genConfig = genConfig; + } + return ChangeDetectorDefinition; + })(); + exports.ChangeDetectorDefinition = ChangeDetectorDefinition; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/lexer", ["angular2/src/core/di/decorators", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + (function(TokenType) { + TokenType[TokenType["Character"] = 0] = "Character"; + TokenType[TokenType["Identifier"] = 1] = "Identifier"; + TokenType[TokenType["Keyword"] = 2] = "Keyword"; + TokenType[TokenType["String"] = 3] = "String"; + TokenType[TokenType["Operator"] = 4] = "Operator"; + TokenType[TokenType["Number"] = 5] = "Number"; + })(exports.TokenType || (exports.TokenType = {})); + var TokenType = exports.TokenType; + var Lexer = (function() { + function Lexer() {} + Lexer.prototype.tokenize = function(text) { + var scanner = new _Scanner(text); + var tokens = []; + var token = scanner.scanToken(); + while (token != null) { + tokens.push(token); + token = scanner.scanToken(); + } + return tokens; + }; + Lexer = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [])], Lexer); + return Lexer; + })(); + exports.Lexer = Lexer; + var Token = (function() { + function Token(index, type, numValue, strValue) { + this.index = index; + this.type = type; + this.numValue = numValue; + this.strValue = strValue; + } + Token.prototype.isCharacter = function(code) { + return (this.type == TokenType.Character && this.numValue == code); + }; + Token.prototype.isNumber = function() { + return (this.type == TokenType.Number); + }; + Token.prototype.isString = function() { + return (this.type == TokenType.String); + }; + Token.prototype.isOperator = function(operater) { + return (this.type == TokenType.Operator && this.strValue == operater); + }; + Token.prototype.isIdentifier = function() { + return (this.type == TokenType.Identifier); + }; + Token.prototype.isKeyword = function() { + return (this.type == TokenType.Keyword); + }; + Token.prototype.isKeywordVar = function() { + return (this.type == TokenType.Keyword && this.strValue == "var"); + }; + Token.prototype.isKeywordNull = function() { + return (this.type == TokenType.Keyword && this.strValue == "null"); + }; + Token.prototype.isKeywordUndefined = function() { + return (this.type == TokenType.Keyword && this.strValue == "undefined"); + }; + Token.prototype.isKeywordTrue = function() { + return (this.type == TokenType.Keyword && this.strValue == "true"); + }; + Token.prototype.isKeywordIf = function() { + return (this.type == TokenType.Keyword && this.strValue == "if"); + }; + Token.prototype.isKeywordElse = function() { + return (this.type == TokenType.Keyword && this.strValue == "else"); + }; + Token.prototype.isKeywordFalse = function() { + return (this.type == TokenType.Keyword && this.strValue == "false"); + }; + Token.prototype.toNumber = function() { + return (this.type == TokenType.Number) ? this.numValue : -1; + }; + Token.prototype.toString = function() { + switch (this.type) { + case TokenType.Character: + case TokenType.Identifier: + case TokenType.Keyword: + case TokenType.Operator: + case TokenType.String: + return this.strValue; + case TokenType.Number: + return this.numValue.toString(); + default: + return null; + } + }; + return Token; + })(); + exports.Token = Token; + function newCharacterToken(index, code) { + return new Token(index, TokenType.Character, code, lang_1.StringWrapper.fromCharCode(code)); + } + function newIdentifierToken(index, text) { + return new Token(index, TokenType.Identifier, 0, text); + } + function newKeywordToken(index, text) { + return new Token(index, TokenType.Keyword, 0, text); + } + function newOperatorToken(index, text) { + return new Token(index, TokenType.Operator, 0, text); + } + function newStringToken(index, text) { + return new Token(index, TokenType.String, 0, text); + } + function newNumberToken(index, n) { + return new Token(index, TokenType.Number, n, ""); + } + exports.EOF = new Token(-1, TokenType.Character, 0, ""); + exports.$EOF = 0; + exports.$TAB = 9; + exports.$LF = 10; + exports.$VTAB = 11; + exports.$FF = 12; + exports.$CR = 13; + exports.$SPACE = 32; + exports.$BANG = 33; + exports.$DQ = 34; + exports.$HASH = 35; + exports.$$ = 36; + exports.$PERCENT = 37; + exports.$AMPERSAND = 38; + exports.$SQ = 39; + exports.$LPAREN = 40; + exports.$RPAREN = 41; + exports.$STAR = 42; + exports.$PLUS = 43; + exports.$COMMA = 44; + exports.$MINUS = 45; + exports.$PERIOD = 46; + exports.$SLASH = 47; + exports.$COLON = 58; + exports.$SEMICOLON = 59; + exports.$LT = 60; + exports.$EQ = 61; + exports.$GT = 62; + exports.$QUESTION = 63; + var $0 = 48; + var $9 = 57; + var $A = 65, + $E = 69, + $Z = 90; + exports.$LBRACKET = 91; + exports.$BACKSLASH = 92; + exports.$RBRACKET = 93; + var $CARET = 94; + var $_ = 95; + var $a = 97, + $e = 101, + $f = 102, + $n = 110, + $r = 114, + $t = 116, + $u = 117, + $v = 118, + $z = 122; + exports.$LBRACE = 123; + exports.$BAR = 124; + exports.$RBRACE = 125; + var $NBSP = 160; + var ScannerError = (function(_super) { + __extends(ScannerError, _super); + function ScannerError(message) { + _super.call(this); + this.message = message; + } + ScannerError.prototype.toString = function() { + return this.message; + }; + return ScannerError; + })(exceptions_1.BaseException); + exports.ScannerError = ScannerError; + var _Scanner = (function() { + function _Scanner(input) { + this.input = input; + this.peek = 0; + this.index = -1; + this.length = input.length; + this.advance(); + } + _Scanner.prototype.advance = function() { + this.peek = ++this.index >= this.length ? exports.$EOF : lang_1.StringWrapper.charCodeAt(this.input, this.index); + }; + _Scanner.prototype.scanToken = function() { + var input = this.input, + length = this.length, + peek = this.peek, + index = this.index; + while (peek <= exports.$SPACE) { + if (++index >= length) { + peek = exports.$EOF; + break; + } else { + peek = lang_1.StringWrapper.charCodeAt(input, index); + } + } + this.peek = peek; + this.index = index; + if (index >= length) { + return null; + } + if (isIdentifierStart(peek)) + return this.scanIdentifier(); + if (isDigit(peek)) + return this.scanNumber(index); + var start = index; + switch (peek) { + case exports.$PERIOD: + this.advance(); + return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, exports.$PERIOD); + case exports.$LPAREN: + case exports.$RPAREN: + case exports.$LBRACE: + case exports.$RBRACE: + case exports.$LBRACKET: + case exports.$RBRACKET: + case exports.$COMMA: + case exports.$COLON: + case exports.$SEMICOLON: + return this.scanCharacter(start, peek); + case exports.$SQ: + case exports.$DQ: + return this.scanString(); + case exports.$HASH: + case exports.$PLUS: + case exports.$MINUS: + case exports.$STAR: + case exports.$SLASH: + case exports.$PERCENT: + case $CARET: + return this.scanOperator(start, lang_1.StringWrapper.fromCharCode(peek)); + case exports.$QUESTION: + return this.scanComplexOperator(start, '?', exports.$PERIOD, '.'); + case exports.$LT: + case exports.$GT: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '='); + case exports.$BANG: + case exports.$EQ: + return this.scanComplexOperator(start, lang_1.StringWrapper.fromCharCode(peek), exports.$EQ, '=', exports.$EQ, '='); + case exports.$AMPERSAND: + return this.scanComplexOperator(start, '&', exports.$AMPERSAND, '&'); + case exports.$BAR: + return this.scanComplexOperator(start, '|', exports.$BAR, '|'); + case $NBSP: + while (isWhitespace(this.peek)) + this.advance(); + return this.scanToken(); + } + this.error("Unexpected character [" + lang_1.StringWrapper.fromCharCode(peek) + "]", 0); + return null; + }; + _Scanner.prototype.scanCharacter = function(start, code) { + assert(this.peek == code); + this.advance(); + return newCharacterToken(start, code); + }; + _Scanner.prototype.scanOperator = function(start, str) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(str, 0)); + assert(collection_1.SetWrapper.has(OPERATORS, str)); + this.advance(); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanComplexOperator = function(start, one, twoCode, two, threeCode, three) { + assert(this.peek == lang_1.StringWrapper.charCodeAt(one, 0)); + this.advance(); + var str = one; + if (this.peek == twoCode) { + this.advance(); + str += two; + } + if (lang_1.isPresent(threeCode) && this.peek == threeCode) { + this.advance(); + str += three; + } + assert(collection_1.SetWrapper.has(OPERATORS, str)); + return newOperatorToken(start, str); + }; + _Scanner.prototype.scanIdentifier = function() { + assert(isIdentifierStart(this.peek)); + var start = this.index; + this.advance(); + while (isIdentifierPart(this.peek)) + this.advance(); + var str = this.input.substring(start, this.index); + if (collection_1.SetWrapper.has(KEYWORDS, str)) { + return newKeywordToken(start, str); + } else { + return newIdentifierToken(start, str); + } + }; + _Scanner.prototype.scanNumber = function(start) { + assert(isDigit(this.peek)); + var simple = (this.index === start); + this.advance(); + while (true) { + if (isDigit(this.peek)) {} else if (this.peek == exports.$PERIOD) { + simple = false; + } else if (isExponentStart(this.peek)) { + this.advance(); + if (isExponentSign(this.peek)) + this.advance(); + if (!isDigit(this.peek)) + this.error('Invalid exponent', -1); + simple = false; + } else { + break; + } + this.advance(); + } + var str = this.input.substring(start, this.index); + var value = simple ? lang_1.NumberWrapper.parseIntAutoRadix(str) : lang_1.NumberWrapper.parseFloat(str); + return newNumberToken(start, value); + }; + _Scanner.prototype.scanString = function() { + assert(this.peek == exports.$SQ || this.peek == exports.$DQ); + var start = this.index; + var quote = this.peek; + this.advance(); + var buffer; + var marker = this.index; + var input = this.input; + while (this.peek != quote) { + if (this.peek == exports.$BACKSLASH) { + if (buffer == null) + buffer = new lang_1.StringJoiner(); + buffer.add(input.substring(marker, this.index)); + this.advance(); + var unescapedCode; + if (this.peek == $u) { + var hex = input.substring(this.index + 1, this.index + 5); + try { + unescapedCode = lang_1.NumberWrapper.parseInt(hex, 16); + } catch (e) { + this.error("Invalid unicode escape [\\u" + hex + "]", 0); + } + for (var i = 0; i < 5; i++) { + this.advance(); + } + } else { + unescapedCode = unescape(this.peek); + this.advance(); + } + buffer.add(lang_1.StringWrapper.fromCharCode(unescapedCode)); + marker = this.index; + } else if (this.peek == exports.$EOF) { + this.error('Unterminated quote', 0); + } else { + this.advance(); + } + } + var last = input.substring(marker, this.index); + this.advance(); + var unescaped = last; + if (buffer != null) { + buffer.add(last); + unescaped = buffer.toString(); + } + return newStringToken(start, unescaped); + }; + _Scanner.prototype.error = function(message, offset) { + var position = this.index + offset; + throw new ScannerError("Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); + }; + return _Scanner; + })(); + function isWhitespace(code) { + return (code >= exports.$TAB && code <= exports.$SPACE) || (code == $NBSP); + } + function isIdentifierStart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == exports.$$); + } + function isIdentifierPart(code) { + return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || ($0 <= code && code <= $9) || (code == $_) || (code == exports.$$); + } + function isDigit(code) { + return $0 <= code && code <= $9; + } + function isExponentStart(code) { + return code == $e || code == $E; + } + function isExponentSign(code) { + return code == exports.$MINUS || code == exports.$PLUS; + } + function unescape(code) { + switch (code) { + case $n: + return exports.$LF; + case $f: + return exports.$FF; + case $r: + return exports.$CR; + case $t: + return exports.$TAB; + case $v: + return exports.$VTAB; + default: + return code; + } + } + var OPERATORS = collection_1.SetWrapper.createFromList(['+', '-', '*', '/', '%', '^', '=', '==', '!=', '===', '!==', '<', '>', '<=', '>=', '&&', '||', '&', '|', '!', '?', '#', '?.']); + var KEYWORDS = collection_1.SetWrapper.createFromList(['var', 'null', 'undefined', 'true', 'false', 'if', 'else']); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/parser", ["angular2/src/core/di/decorators", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/parser/ast"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var decorators_1 = require("angular2/src/core/di/decorators"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var _implicitReceiver = new ast_1.ImplicitReceiver(); + var INTERPOLATION_REGEXP = /\{\{(.*?)\}\}/g; + var ParseException = (function(_super) { + __extends(ParseException, _super); + function ParseException(message, input, errLocation, ctxLocation) { + _super.call(this, "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation); + } + return ParseException; + })(exceptions_1.BaseException); + var Parser = (function() { + function Parser(_lexer, providedReflector) { + if (providedReflector === void 0) { + providedReflector = null; + } + this._lexer = _lexer; + this._reflector = lang_1.isPresent(providedReflector) ? providedReflector : reflection_1.reflector; + } + Parser.prototype.parseAction = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, true).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseSimpleBinding = function(input, location) { + this._checkNoInterpolation(input, location); + var tokens = this._lexer.tokenize(input); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseSimpleBinding(); + return new ast_1.ASTWithSource(ast, input, location); + }; + Parser.prototype.parseTemplateBindings = function(input, location) { + var tokens = this._lexer.tokenize(input); + return new _ParseAST(input, location, tokens, this._reflector, false).parseTemplateBindings(); + }; + Parser.prototype.parseInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length <= 1) { + return null; + } + var strings = []; + var expressions = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (i % 2 === 0) { + strings.push(part); + } else if (part.trim().length > 0) { + var tokens = this._lexer.tokenize(part); + var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); + expressions.push(ast); + } else { + throw new ParseException('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i) + " in", location); + } + } + return new ast_1.ASTWithSource(new ast_1.Interpolation(strings, expressions), input, location); + }; + Parser.prototype.wrapLiteralPrimitive = function(input, location) { + return new ast_1.ASTWithSource(new ast_1.LiteralPrimitive(input), input, location); + }; + Parser.prototype._checkNoInterpolation = function(input, location) { + var parts = lang_1.StringWrapper.split(input, INTERPOLATION_REGEXP); + if (parts.length > 1) { + throw new ParseException('Got interpolation ({{}}) where expression was expected', input, "at column " + this._findInterpolationErrorColumn(parts, 1) + " in", location); + } + }; + Parser.prototype._findInterpolationErrorColumn = function(parts, partInErrIdx) { + var errLocation = ''; + for (var j = 0; j < partInErrIdx; j++) { + errLocation += j % 2 === 0 ? parts[j] : "{{" + parts[j] + "}}"; + } + return errLocation.length; + }; + Parser = __decorate([decorators_1.Injectable(), __metadata('design:paramtypes', [lexer_1.Lexer, reflection_1.Reflector])], Parser); + return Parser; + })(); + exports.Parser = Parser; + var _ParseAST = (function() { + function _ParseAST(input, location, tokens, reflector, parseAction) { + this.input = input; + this.location = location; + this.tokens = tokens; + this.reflector = reflector; + this.parseAction = parseAction; + this.index = 0; + } + _ParseAST.prototype.peek = function(offset) { + var i = this.index + offset; + return i < this.tokens.length ? this.tokens[i] : lexer_1.EOF; + }; + Object.defineProperty(_ParseAST.prototype, "next", { + get: function() { + return this.peek(0); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(_ParseAST.prototype, "inputIndex", { + get: function() { + return (this.index < this.tokens.length) ? this.next.index : this.input.length; + }, + enumerable: true, + configurable: true + }); + _ParseAST.prototype.advance = function() { + this.index++; + }; + _ParseAST.prototype.optionalCharacter = function(code) { + if (this.next.isCharacter(code)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.optionalKeywordVar = function() { + if (this.peekKeywordVar()) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.peekKeywordVar = function() { + return this.next.isKeywordVar() || this.next.isOperator('#'); + }; + _ParseAST.prototype.expectCharacter = function(code) { + if (this.optionalCharacter(code)) + return ; + this.error("Missing expected " + lang_1.StringWrapper.fromCharCode(code)); + }; + _ParseAST.prototype.optionalOperator = function(op) { + if (this.next.isOperator(op)) { + this.advance(); + return true; + } else { + return false; + } + }; + _ParseAST.prototype.expectOperator = function(operator) { + if (this.optionalOperator(operator)) + return ; + this.error("Missing expected operator " + operator); + }; + _ParseAST.prototype.expectIdentifierOrKeyword = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword()) { + this.error("Unexpected token " + n + ", expected identifier or keyword"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.expectIdentifierOrKeywordOrString = function() { + var n = this.next; + if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { + this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); + } + this.advance(); + return n.toString(); + }; + _ParseAST.prototype.parseChain = function() { + var exprs = []; + while (this.index < this.tokens.length) { + var expr = this.parsePipe(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } else if (this.index < this.tokens.length) { + this.error("Unexpected token '" + this.next + "'"); + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.parseSimpleBinding = function() { + var ast = this.parseChain(); + if (!SimpleExpressionChecker.check(ast)) { + this.error("Simple binding expression can only contain field access and constants'"); + } + return ast; + }; + _ParseAST.prototype.parsePipe = function() { + var result = this.parseExpression(); + if (this.optionalOperator("|")) { + if (this.parseAction) { + this.error("Cannot have a pipe in an action expression"); + } + do { + var name = this.expectIdentifierOrKeyword(); + var args = []; + while (this.optionalCharacter(lexer_1.$COLON)) { + args.push(this.parsePipe()); + } + result = new ast_1.BindingPipe(result, name, args); + } while (this.optionalOperator("|")); + } + return result; + }; + _ParseAST.prototype.parseExpression = function() { + return this.parseConditional(); + }; + _ParseAST.prototype.parseConditional = function() { + var start = this.inputIndex; + var result = this.parseLogicalOr(); + if (this.optionalOperator('?')) { + var yes = this.parsePipe(); + if (!this.optionalCharacter(lexer_1.$COLON)) { + var end = this.inputIndex; + var expression = this.input.substring(start, end); + this.error("Conditional expression " + expression + " requires all 3 expressions"); + } + var no = this.parsePipe(); + return new ast_1.Conditional(result, yes, no); + } else { + return result; + } + }; + _ParseAST.prototype.parseLogicalOr = function() { + var result = this.parseLogicalAnd(); + while (this.optionalOperator('||')) { + result = new ast_1.Binary('||', result, this.parseLogicalAnd()); + } + return result; + }; + _ParseAST.prototype.parseLogicalAnd = function() { + var result = this.parseEquality(); + while (this.optionalOperator('&&')) { + result = new ast_1.Binary('&&', result, this.parseEquality()); + } + return result; + }; + _ParseAST.prototype.parseEquality = function() { + var result = this.parseRelational(); + while (true) { + if (this.optionalOperator('==')) { + result = new ast_1.Binary('==', result, this.parseRelational()); + } else if (this.optionalOperator('===')) { + result = new ast_1.Binary('===', result, this.parseRelational()); + } else if (this.optionalOperator('!=')) { + result = new ast_1.Binary('!=', result, this.parseRelational()); + } else if (this.optionalOperator('!==')) { + result = new ast_1.Binary('!==', result, this.parseRelational()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseRelational = function() { + var result = this.parseAdditive(); + while (true) { + if (this.optionalOperator('<')) { + result = new ast_1.Binary('<', result, this.parseAdditive()); + } else if (this.optionalOperator('>')) { + result = new ast_1.Binary('>', result, this.parseAdditive()); + } else if (this.optionalOperator('<=')) { + result = new ast_1.Binary('<=', result, this.parseAdditive()); + } else if (this.optionalOperator('>=')) { + result = new ast_1.Binary('>=', result, this.parseAdditive()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseAdditive = function() { + var result = this.parseMultiplicative(); + while (true) { + if (this.optionalOperator('+')) { + result = new ast_1.Binary('+', result, this.parseMultiplicative()); + } else if (this.optionalOperator('-')) { + result = new ast_1.Binary('-', result, this.parseMultiplicative()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parseMultiplicative = function() { + var result = this.parsePrefix(); + while (true) { + if (this.optionalOperator('*')) { + result = new ast_1.Binary('*', result, this.parsePrefix()); + } else if (this.optionalOperator('%')) { + result = new ast_1.Binary('%', result, this.parsePrefix()); + } else if (this.optionalOperator('/')) { + result = new ast_1.Binary('/', result, this.parsePrefix()); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrefix = function() { + if (this.optionalOperator('+')) { + return this.parsePrefix(); + } else if (this.optionalOperator('-')) { + return new ast_1.Binary('-', new ast_1.LiteralPrimitive(0), this.parsePrefix()); + } else if (this.optionalOperator('!')) { + return new ast_1.PrefixNot(this.parsePrefix()); + } else { + return this.parseCallChain(); + } + }; + _ParseAST.prototype.parseCallChain = function() { + var result = this.parsePrimary(); + while (true) { + if (this.optionalCharacter(lexer_1.$PERIOD)) { + result = this.parseAccessMemberOrMethodCall(result, false); + } else if (this.optionalOperator('?.')) { + result = this.parseAccessMemberOrMethodCall(result, true); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var key = this.parsePipe(); + this.expectCharacter(lexer_1.$RBRACKET); + if (this.optionalOperator("=")) { + var value = this.parseConditional(); + result = new ast_1.KeyedWrite(result, key, value); + } else { + result = new ast_1.KeyedRead(result, key); + } + } else if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + result = new ast_1.FunctionCall(result, args); + } else { + return result; + } + } + }; + _ParseAST.prototype.parsePrimary = function() { + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var result = this.parsePipe(); + this.expectCharacter(lexer_1.$RPAREN); + return result; + } else if (this.next.isKeywordNull() || this.next.isKeywordUndefined()) { + this.advance(); + return new ast_1.LiteralPrimitive(null); + } else if (this.next.isKeywordTrue()) { + this.advance(); + return new ast_1.LiteralPrimitive(true); + } else if (this.next.isKeywordFalse()) { + this.advance(); + return new ast_1.LiteralPrimitive(false); + } else if (this.parseAction && this.next.isKeywordIf()) { + this.advance(); + this.expectCharacter(lexer_1.$LPAREN); + var condition = this.parseExpression(); + this.expectCharacter(lexer_1.$RPAREN); + var ifExp = this.parseExpressionOrBlock(); + var elseExp; + if (this.next.isKeywordElse()) { + this.advance(); + elseExp = this.parseExpressionOrBlock(); + } + return new ast_1.If(condition, ifExp, elseExp); + } else if (this.optionalCharacter(lexer_1.$LBRACKET)) { + var elements = this.parseExpressionList(lexer_1.$RBRACKET); + this.expectCharacter(lexer_1.$RBRACKET); + return new ast_1.LiteralArray(elements); + } else if (this.next.isCharacter(lexer_1.$LBRACE)) { + return this.parseLiteralMap(); + } else if (this.next.isIdentifier()) { + return this.parseAccessMemberOrMethodCall(_implicitReceiver, false); + } else if (this.next.isNumber()) { + var value = this.next.toNumber(); + this.advance(); + return new ast_1.LiteralPrimitive(value); + } else if (this.next.isString()) { + var literalValue = this.next.toString(); + this.advance(); + return new ast_1.LiteralPrimitive(literalValue); + } else if (this.index >= this.tokens.length) { + this.error("Unexpected end of expression: " + this.input); + } else { + this.error("Unexpected token " + this.next); + } + throw new exceptions_1.BaseException("Fell through all cases in parsePrimary"); + }; + _ParseAST.prototype.parseExpressionList = function(terminator) { + var result = []; + if (!this.next.isCharacter(terminator)) { + do { + result.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + } + return result; + }; + _ParseAST.prototype.parseLiteralMap = function() { + var keys = []; + var values = []; + this.expectCharacter(lexer_1.$LBRACE); + if (!this.optionalCharacter(lexer_1.$RBRACE)) { + do { + var key = this.expectIdentifierOrKeywordOrString(); + keys.push(key); + this.expectCharacter(lexer_1.$COLON); + values.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + this.expectCharacter(lexer_1.$RBRACE); + } + return new ast_1.LiteralMap(keys, values); + }; + _ParseAST.prototype.parseAccessMemberOrMethodCall = function(receiver, isSafe) { + if (isSafe === void 0) { + isSafe = false; + } + var id = this.expectIdentifierOrKeyword(); + if (this.optionalCharacter(lexer_1.$LPAREN)) { + var args = this.parseCallArguments(); + this.expectCharacter(lexer_1.$RPAREN); + var fn = this.reflector.method(id); + return isSafe ? new ast_1.SafeMethodCall(receiver, id, fn, args) : new ast_1.MethodCall(receiver, id, fn, args); + } else { + if (isSafe) { + if (this.optionalOperator("=")) { + this.error("The '?.' operator cannot be used in the assignment"); + } else { + return new ast_1.SafePropertyRead(receiver, id, this.reflector.getter(id)); + } + } else { + if (this.optionalOperator("=")) { + if (!this.parseAction) { + this.error("Bindings cannot contain assignments"); + } + var value = this.parseConditional(); + return new ast_1.PropertyWrite(receiver, id, this.reflector.setter(id), value); + } else { + return new ast_1.PropertyRead(receiver, id, this.reflector.getter(id)); + } + } + } + return null; + }; + _ParseAST.prototype.parseCallArguments = function() { + if (this.next.isCharacter(lexer_1.$RPAREN)) + return []; + var positionals = []; + do { + positionals.push(this.parsePipe()); + } while (this.optionalCharacter(lexer_1.$COMMA)); + return positionals; + }; + _ParseAST.prototype.parseExpressionOrBlock = function() { + if (this.optionalCharacter(lexer_1.$LBRACE)) { + var block = this.parseBlockContent(); + this.expectCharacter(lexer_1.$RBRACE); + return block; + } + return this.parseExpression(); + }; + _ParseAST.prototype.parseBlockContent = function() { + if (!this.parseAction) { + this.error("Binding expression cannot contain chained expression"); + } + var exprs = []; + while (this.index < this.tokens.length && !this.next.isCharacter(lexer_1.$RBRACE)) { + var expr = this.parseExpression(); + exprs.push(expr); + if (this.optionalCharacter(lexer_1.$SEMICOLON)) { + while (this.optionalCharacter(lexer_1.$SEMICOLON)) {} + } + } + if (exprs.length == 0) + return new ast_1.EmptyExpr(); + if (exprs.length == 1) + return exprs[0]; + return new ast_1.Chain(exprs); + }; + _ParseAST.prototype.expectTemplateBindingKey = function() { + var result = ''; + var operatorFound = false; + do { + result += this.expectIdentifierOrKeywordOrString(); + operatorFound = this.optionalOperator('-'); + if (operatorFound) { + result += '-'; + } + } while (operatorFound); + return result.toString(); + }; + _ParseAST.prototype.parseTemplateBindings = function() { + var bindings = []; + var prefix = null; + while (this.index < this.tokens.length) { + var keyIsVar = this.optionalKeywordVar(); + var key = this.expectTemplateBindingKey(); + if (!keyIsVar) { + if (prefix == null) { + prefix = key; + } else { + key = prefix + '-' + key; + } + } + this.optionalCharacter(lexer_1.$COLON); + var name = null; + var expression = null; + if (keyIsVar) { + if (this.optionalOperator("=")) { + name = this.expectTemplateBindingKey(); + } else { + name = '\$implicit'; + } + } else if (this.next !== lexer_1.EOF && !this.peekKeywordVar()) { + var start = this.inputIndex; + var ast = this.parsePipe(); + var source = this.input.substring(start, this.inputIndex); + expression = new ast_1.ASTWithSource(ast, source, this.location); + } + bindings.push(new ast_1.TemplateBinding(key, keyIsVar, name, expression)); + if (!this.optionalCharacter(lexer_1.$SEMICOLON)) { + this.optionalCharacter(lexer_1.$COMMA); + } + } + return bindings; + }; + _ParseAST.prototype.error = function(message, index) { + if (index === void 0) { + index = null; + } + if (lang_1.isBlank(index)) + index = this.index; + var location = (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; + throw new ParseException(message, this.input, location, this.location); + }; + return _ParseAST; + })(); + exports._ParseAST = _ParseAST; + var SimpleExpressionChecker = (function() { + function SimpleExpressionChecker() { + this.simple = true; + } + SimpleExpressionChecker.check = function(ast) { + var s = new SimpleExpressionChecker(); + ast.visit(s); + return s.simple; + }; + SimpleExpressionChecker.prototype.visitImplicitReceiver = function(ast) {}; + SimpleExpressionChecker.prototype.visitInterpolation = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralPrimitive = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyRead = function(ast) {}; + SimpleExpressionChecker.prototype.visitPropertyWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafePropertyRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitSafeMethodCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitFunctionCall = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitLiteralArray = function(ast) { + this.visitAll(ast.expressions); + }; + SimpleExpressionChecker.prototype.visitLiteralMap = function(ast) { + this.visitAll(ast.values); + }; + SimpleExpressionChecker.prototype.visitBinary = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPrefixNot = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitConditional = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitPipe = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedRead = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitKeyedWrite = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + SimpleExpressionChecker.prototype.visitChain = function(ast) { + this.simple = false; + }; + SimpleExpressionChecker.prototype.visitIf = function(ast) { + this.simple = false; + }; + return SimpleExpressionChecker; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/parser/locals", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var Locals = (function() { + function Locals(parent, current) { + this.parent = parent; + this.current = current; + } + Locals.prototype.contains = function(name) { + if (this.current.has(name)) { + return true; + } + if (lang_1.isPresent(this.parent)) { + return this.parent.contains(name); + } + return false; + }; + Locals.prototype.get = function(name) { + if (this.current.has(name)) { + return this.current.get(name); + } + if (lang_1.isPresent(this.parent)) { + return this.parent.get(name); + } + throw new exceptions_1.BaseException("Cannot find '" + name + "'"); + }; + Locals.prototype.set = function(name, value) { + if (this.current.has(name)) { + this.current.set(name, value); + } else { + throw new exceptions_1.BaseException("Setting of new keys post-construction is not supported. Key: " + name + "."); + } + }; + Locals.prototype.clearValues = function() { + collection_1.MapWrapper.clearValues(this.current); + }; + return Locals; + })(); + exports.Locals = Locals; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/api", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var EventBinding = (function() { + function EventBinding(fullName, source) { + this.fullName = fullName; + this.source = source; + } + return EventBinding; + })(); + exports.EventBinding = EventBinding; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["PROPERTY"] = 0] = "PROPERTY"; + PropertyBindingType[PropertyBindingType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + PropertyBindingType[PropertyBindingType["CLASS"] = 2] = "CLASS"; + PropertyBindingType[PropertyBindingType["STYLE"] = 3] = "STYLE"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + var ElementPropertyBinding = (function() { + function ElementPropertyBinding(type, astWithSource, property, unit) { + if (unit === void 0) { + unit = null; + } + this.type = type; + this.astWithSource = astWithSource; + this.property = property; + this.unit = unit; + } + return ElementPropertyBinding; + })(); + exports.ElementPropertyBinding = ElementPropertyBinding; + var RenderElementBinder = (function() { + function RenderElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + index = _b.index, + parentIndex = _b.parentIndex, + distanceToParent = _b.distanceToParent, + directives = _b.directives, + nestedProtoView = _b.nestedProtoView, + propertyBindings = _b.propertyBindings, + variableBindings = _b.variableBindings, + eventBindings = _b.eventBindings, + readAttributes = _b.readAttributes; + this.index = index; + this.parentIndex = parentIndex; + this.distanceToParent = distanceToParent; + this.directives = directives; + this.nestedProtoView = nestedProtoView; + this.propertyBindings = propertyBindings; + this.variableBindings = variableBindings; + this.eventBindings = eventBindings; + this.readAttributes = readAttributes; + } + return RenderElementBinder; + })(); + exports.RenderElementBinder = RenderElementBinder; + var DirectiveBinder = (function() { + function DirectiveBinder(_a) { + var directiveIndex = _a.directiveIndex, + propertyBindings = _a.propertyBindings, + eventBindings = _a.eventBindings, + hostPropertyBindings = _a.hostPropertyBindings; + this.directiveIndex = directiveIndex; + this.propertyBindings = propertyBindings; + this.eventBindings = eventBindings; + this.hostPropertyBindings = hostPropertyBindings; + } + return DirectiveBinder; + })(); + exports.DirectiveBinder = DirectiveBinder; + (function(ViewType) { + ViewType[ViewType["HOST"] = 0] = "HOST"; + ViewType[ViewType["COMPONENT"] = 1] = "COMPONENT"; + ViewType[ViewType["EMBEDDED"] = 2] = "EMBEDDED"; + })(exports.ViewType || (exports.ViewType = {})); + var ViewType = exports.ViewType; + var ProtoViewDto = (function() { + function ProtoViewDto(_a) { + var render = _a.render, + elementBinders = _a.elementBinders, + variableBindings = _a.variableBindings, + type = _a.type, + textBindings = _a.textBindings, + transitiveNgContentCount = _a.transitiveNgContentCount; + this.render = render; + this.elementBinders = elementBinders; + this.variableBindings = variableBindings; + this.type = type; + this.textBindings = textBindings; + this.transitiveNgContentCount = transitiveNgContentCount; + } + return ProtoViewDto; + })(); + exports.ProtoViewDto = ProtoViewDto; + var RenderDirectiveMetadata = (function() { + function RenderDirectiveMetadata(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + hostListeners = _a.hostListeners, + hostProperties = _a.hostProperties, + hostAttributes = _a.hostAttributes, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + this.id = id; + this.selector = selector; + this.compileChildren = lang_1.isPresent(compileChildren) ? compileChildren : true; + this.events = events; + this.hostListeners = hostListeners; + this.hostAttributes = hostAttributes; + this.hostProperties = hostProperties; + this.properties = properties; + this.readAttributes = readAttributes; + this.type = type; + this.callOnDestroy = callOnDestroy; + this.callOnChanges = callOnChanges; + this.callDoCheck = callDoCheck; + this.callOnInit = callOnInit; + this.callAfterContentInit = callAfterContentInit; + this.callAfterContentChecked = callAfterContentChecked; + this.callAfterViewInit = callAfterViewInit; + this.callAfterViewChecked = callAfterViewChecked; + this.changeDetection = changeDetection; + this.exportAs = exportAs; + this.queries = queries; + } + Object.defineProperty(RenderDirectiveMetadata, "DIRECTIVE_TYPE", { + get: function() { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(RenderDirectiveMetadata, "COMPONENT_TYPE", { + get: function() { + return 1; + }, + enumerable: true, + configurable: true + }); + RenderDirectiveMetadata.create = function(_a) { + var id = _a.id, + selector = _a.selector, + compileChildren = _a.compileChildren, + events = _a.events, + host = _a.host, + properties = _a.properties, + readAttributes = _a.readAttributes, + type = _a.type, + callOnDestroy = _a.callOnDestroy, + callOnChanges = _a.callOnChanges, + callDoCheck = _a.callDoCheck, + callOnInit = _a.callOnInit, + callAfterContentInit = _a.callAfterContentInit, + callAfterContentChecked = _a.callAfterContentChecked, + callAfterViewInit = _a.callAfterViewInit, + callAfterViewChecked = _a.callAfterViewChecked, + changeDetection = _a.changeDetection, + exportAs = _a.exportAs, + queries = _a.queries; + var hostListeners = new collection_1.Map(); + var hostProperties = new collection_1.Map(); + var hostAttributes = new collection_1.Map(); + if (lang_1.isPresent(host)) { + collection_1.MapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(RenderDirectiveMetadata._hostRegExp, key); + if (lang_1.isBlank(matches)) { + hostAttributes.set(key, value); + } else if (lang_1.isPresent(matches[1])) { + hostProperties.set(matches[1], value); + } else if (lang_1.isPresent(matches[2])) { + hostListeners.set(matches[2], value); + } + }); + } + return new RenderDirectiveMetadata({ + id: id, + selector: selector, + compileChildren: compileChildren, + events: events, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + properties: properties, + readAttributes: readAttributes, + type: type, + callOnDestroy: callOnDestroy, + callOnChanges: callOnChanges, + callDoCheck: callDoCheck, + callOnInit: callOnInit, + callAfterContentInit: callAfterContentInit, + callAfterContentChecked: callAfterContentChecked, + callAfterViewInit: callAfterViewInit, + callAfterViewChecked: callAfterViewChecked, + changeDetection: changeDetection, + exportAs: exportAs, + queries: queries + }); + }; + RenderDirectiveMetadata._hostRegExp = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + return RenderDirectiveMetadata; + })(); + exports.RenderDirectiveMetadata = RenderDirectiveMetadata; + var RenderProtoViewRef = (function() { + function RenderProtoViewRef() {} + return RenderProtoViewRef; + })(); + exports.RenderProtoViewRef = RenderProtoViewRef; + var RenderFragmentRef = (function() { + function RenderFragmentRef() {} + return RenderFragmentRef; + })(); + exports.RenderFragmentRef = RenderFragmentRef; + var RenderViewRef = (function() { + function RenderViewRef() {} + return RenderViewRef; + })(); + exports.RenderViewRef = RenderViewRef; + (function(ViewEncapsulation) { + ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; + ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; + ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; + })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {})); + var ViewEncapsulation = exports.ViewEncapsulation; + exports.VIEW_ENCAPSULATION_VALUES = [ViewEncapsulation.Emulated, ViewEncapsulation.Native, ViewEncapsulation.None]; + var ViewDefinition = (function() { + function ViewDefinition(_a) { + var _b = _a === void 0 ? {} : _a, + componentId = _b.componentId, + templateAbsUrl = _b.templateAbsUrl, + template = _b.template, + styleAbsUrls = _b.styleAbsUrls, + styles = _b.styles, + directives = _b.directives, + encapsulation = _b.encapsulation; + this.componentId = componentId; + this.templateAbsUrl = templateAbsUrl; + this.template = template; + this.styleAbsUrls = styleAbsUrls; + this.styles = styles; + this.directives = directives; + this.encapsulation = lang_1.isPresent(encapsulation) ? encapsulation : ViewEncapsulation.Emulated; + } + return ViewDefinition; + })(); + exports.ViewDefinition = ViewDefinition; + var RenderProtoViewMergeMapping = (function() { + function RenderProtoViewMergeMapping(mergedProtoViewRef, fragmentCount, mappedElementIndices, mappedElementCount, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCountByViewIndex) { + this.mergedProtoViewRef = mergedProtoViewRef; + this.fragmentCount = fragmentCount; + this.mappedElementIndices = mappedElementIndices; + this.mappedElementCount = mappedElementCount; + this.mappedTextIndices = mappedTextIndices; + this.hostElementIndicesByViewIndex = hostElementIndicesByViewIndex; + this.nestedViewCountByViewIndex = nestedViewCountByViewIndex; + } + return RenderProtoViewMergeMapping; + })(); + exports.RenderProtoViewMergeMapping = RenderProtoViewMergeMapping; + var RenderCompiler = (function() { + function RenderCompiler() {} + RenderCompiler.prototype.compileHost = function(directiveMetadata) { + return null; + }; + RenderCompiler.prototype.compile = function(view) { + return null; + }; + RenderCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return null; + }; + return RenderCompiler; + })(); + exports.RenderCompiler = RenderCompiler; + var RenderViewWithFragments = (function() { + function RenderViewWithFragments(viewRef, fragmentRefs) { + this.viewRef = viewRef; + this.fragmentRefs = fragmentRefs; + } + return RenderViewWithFragments; + })(); + exports.RenderViewWithFragments = RenderViewWithFragments; + var Renderer = (function() { + function Renderer() {} + Renderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return null; + }; + Renderer.prototype.createView = function(protoViewRef, fragmentCount) { + return null; + }; + Renderer.prototype.destroyView = function(viewRef) {}; + Renderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) {}; + Renderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) {}; + Renderer.prototype.detachFragment = function(fragmentRef) {}; + Renderer.prototype.hydrateView = function(viewRef) {}; + Renderer.prototype.dehydrateView = function(viewRef) {}; + Renderer.prototype.getNativeElementSync = function(location) { + return null; + }; + Renderer.prototype.setElementProperty = function(location, propertyName, propertyValue) {}; + Renderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) {}; + Renderer.prototype.setElementClass = function(location, className, isAdd) {}; + Renderer.prototype.setElementStyle = function(location, styleName, styleValue) {}; + Renderer.prototype.invokeElementMethod = function(location, methodName, args) {}; + Renderer.prototype.setText = function(viewRef, textNodeIndex, text) {}; + Renderer.prototype.setEventDispatcher = function(viewRef, dispatcher) {}; + return Renderer; + })(); + exports.Renderer = Renderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/util", ["angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Class = decorators_1.Class; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/noop", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = noop; + function noop() {} + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/throwError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = throwError; + function throwError(e) { + throw e; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/tryOrOnError", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + exports["default"] = tryOrOnError; + function tryOrOnError(target) { + function tryCatcher() { + try { + tryCatcher.target.apply(this, arguments); + } catch (e) { + this.error(e); + } + } + tryCatcher.target = target; + return tryCatcher; + } + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscription", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + "use strict"; + exports.__esModule = true; + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + var Subscription = (function() { + function Subscription(_unsubscribe) { + _classCallCheck(this, Subscription); + this.isUnsubscribed = false; + if (_unsubscribe) { + this._unsubscribe = _unsubscribe; + } + } + Subscription.prototype._unsubscribe = function _unsubscribe() {}; + Subscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var unsubscribe = this._unsubscribe; + var subscriptions = this._subscriptions; + this._subscriptions = void 0; + if (unsubscribe) { + unsubscribe.call(this); + } + if (subscriptions != null) { + var index = -1; + var len = subscriptions.length; + while (++index < len) { + subscriptions[index].unsubscribe(); + } + } + }; + Subscription.prototype.add = function add(subscription) { + if (!subscription || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var sub = subscription; + switch (typeof subscription) { + case "function": + sub = new Subscription(subscription); + case "object": + if (sub.isUnsubscribed || typeof sub.unsubscribe !== "function") { + break; + } else if (this.isUnsubscribed) { + sub.unsubscribe(); + } else { + var subscriptions = this._subscriptions || (this._subscriptions = []); + subscriptions.push(sub); + } + break; + default: + throw new Error('Unrecognized subscription ' + subscription + ' added to Subscription.'); + } + }; + Subscription.prototype.remove = function remove(subscription) { + if (subscription == null || subscription === this || subscription === Subscription.EMPTY) { + return ; + } + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + return Subscription; + })(); + exports["default"] = Subscription; + Subscription.EMPTY = (function(empty) { + empty.isUnsubscribed = true; + return empty; + })(new Subscription()); + module.exports = exports["default"]; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/root", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + var root = objectTypes[typeof self] && self || objectTypes[typeof window] && window; + exports.root = root; + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + exports.root = root = freeGlobal; + } + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription", ["@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var SubjectSubscription = (function(_Subscription) { + _inherits(SubjectSubscription, _Subscription); + function SubjectSubscription(subject, observer) { + _classCallCheck(this, SubjectSubscription); + _Subscription.call(this); + this.subject = subject; + this.observer = observer; + this.isUnsubscribed = false; + } + SubjectSubscription.prototype.unsubscribe = function unsubscribe() { + if (this.isUnsubscribed) { + return ; + } + this.isUnsubscribed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = void 0; + if (!observers || observers.length === 0 || subject.isUnsubscribed) { + return ; + } + var subscriberIndex = observers.indexOf(this.observer); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; + })(_Subscription3['default']); + exports['default'] = SubjectSubscription; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/invalid_pipe_argument_exception", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var InvalidPipeArgumentException = (function(_super) { + __extends(InvalidPipeArgumentException, _super); + function InvalidPipeArgumentException(type, value) { + _super.call(this, "Invalid argument '" + value + "' for pipe '" + type + "'"); + } + return InvalidPipeArgumentException; + })(exceptions_1.BaseException); + exports.InvalidPipeArgumentException = InvalidPipeArgumentException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/intl", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(NumberFormatStyle) { + NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal"; + NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent"; + NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency"; + })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {})); + var NumberFormatStyle = exports.NumberFormatStyle; + var NumberFormatter = (function() { + function NumberFormatter() {} + NumberFormatter.format = function(number, locale, style, _a) { + var _b = _a === void 0 ? {} : _a, + _c = _b.minimumIntegerDigits, + minimumIntegerDigits = _c === void 0 ? 1 : _c, + _d = _b.minimumFractionDigits, + minimumFractionDigits = _d === void 0 ? 0 : _d, + _e = _b.maximumFractionDigits, + maximumFractionDigits = _e === void 0 ? 3 : _e, + currency = _b.currency, + _f = _b.currencyAsSymbol, + currencyAsSymbol = _f === void 0 ? false : _f; + var intlOptions = { + minimumIntegerDigits: minimumIntegerDigits, + minimumFractionDigits: minimumFractionDigits, + maximumFractionDigits: maximumFractionDigits + }; + intlOptions.style = NumberFormatStyle[style].toLowerCase(); + if (style == NumberFormatStyle.Currency) { + intlOptions.currency = currency; + intlOptions.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; + } + return new Intl.NumberFormat(locale, intlOptions).format(number); + }; + return NumberFormatter; + })(); + exports.NumberFormatter = NumberFormatter; + function digitCondition(len) { + return len == 2 ? '2-digit' : 'numeric'; + } + function nameCondition(len) { + return len < 4 ? 'short' : 'long'; + } + function extractComponents(pattern) { + var ret = {}; + var i = 0, + j; + while (i < pattern.length) { + j = i; + while (j < pattern.length && pattern[j] == pattern[i]) + j++; + var len = j - i; + switch (pattern[i]) { + case 'G': + ret.era = nameCondition(len); + break; + case 'y': + ret.year = digitCondition(len); + break; + case 'M': + if (len >= 3) + ret.month = nameCondition(len); + else + ret.month = digitCondition(len); + break; + case 'd': + ret.day = digitCondition(len); + break; + case 'E': + ret.weekday = nameCondition(len); + break; + case 'j': + ret.hour = digitCondition(len); + break; + case 'h': + ret.hour = digitCondition(len); + ret.hour12 = true; + break; + case 'H': + ret.hour = digitCondition(len); + ret.hour12 = false; + break; + case 'm': + ret.minute = digitCondition(len); + break; + case 's': + ret.second = digitCondition(len); + break; + case 'z': + ret.timeZoneName = 'long'; + break; + case 'Z': + ret.timeZoneName = 'short'; + break; + } + i = j; + } + return ret; + } + var dateFormatterCache = new Map(); + var DateFormatter = (function() { + function DateFormatter() {} + DateFormatter.format = function(date, locale, pattern) { + var key = locale + pattern; + if (dateFormatterCache.has(key)) { + return dateFormatterCache.get(key).format(date); + } + var formatter = new Intl.DateTimeFormat(locale, extractComponents(pattern)); + dateFormatterCache.set(key, formatter); + return formatter.format(date); + }; + return DateFormatter; + })(); + exports.DateFormatter = DateFormatter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/uppercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var UpperCasePipe = (function() { + function UpperCasePipe() {} + UpperCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(UpperCasePipe, value); + } + return lang_1.StringWrapper.toUpperCase(value); + }; + UpperCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'uppercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], UpperCasePipe); + return UpperCasePipe; + })(); + exports.UpperCasePipe = UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/lowercase_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var LowerCasePipe = (function() { + function LowerCasePipe() {} + LowerCasePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(value)) + return value; + if (!lang_1.isString(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(LowerCasePipe, value); + } + return lang_1.StringWrapper.toLowerCase(value); + }; + LowerCasePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'lowercase'}), di_1.Injectable(), __metadata('design:paramtypes', [])], LowerCasePipe); + return LowerCasePipe; + })(); + exports.LowerCasePipe = LowerCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/json_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var JsonPipe = (function() { + function JsonPipe() {} + JsonPipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + return lang_1.Json.stringify(value); + }; + JsonPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'json'}), di_1.Injectable(), __metadata('design:paramtypes', [])], JsonPipe); + return JsonPipe; + })(); + exports.JsonPipe = JsonPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/slice_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/pipes/invalid_pipe_argument_exception", "angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var metadata_1 = require("angular2/src/core/metadata"); + var SlicePipe = (function() { + function SlicePipe() {} + SlicePipe.prototype.transform = function(value, args) { + if (args === void 0) { + args = null; + } + if (lang_1.isBlank(args) || args.length == 0) { + throw new exceptions_1.BaseException('Slice pipe requires one argument'); + } + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(SlicePipe, value); + } + if (lang_1.isBlank(value)) + return value; + var start = args[0]; + var end = args.length > 1 ? args[1] : null; + if (lang_1.isString(value)) { + return lang_1.StringWrapper.slice(value, start, end); + } + return collection_1.ListWrapper.slice(value, start, end); + }; + SlicePipe.prototype.supports = function(obj) { + return lang_1.isString(obj) || lang_1.isArray(obj); + }; + SlicePipe = __decorate([metadata_1.Pipe({name: 'slice'}), di_1.Injectable(), __metadata('design:paramtypes', [])], SlicePipe); + return SlicePipe; + })(); + exports.SlicePipe = SlicePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/number_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var _re = lang_1.RegExpWrapper.create('^(\\d+)?\\.((\\d+)(\\-(\\d+))?)?$'); + var NumberPipe = (function() { + function NumberPipe() {} + NumberPipe._format = function(value, style, digits, currency, currencyAsSymbol) { + if (currency === void 0) { + currency = null; + } + if (currencyAsSymbol === void 0) { + currencyAsSymbol = false; + } + if (lang_1.isBlank(value)) + return null; + if (!lang_1.isNumber(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(NumberPipe, value); + } + var minInt = 1, + minFraction = 0, + maxFraction = 3; + if (lang_1.isPresent(digits)) { + var parts = lang_1.RegExpWrapper.firstMatch(_re, digits); + if (lang_1.isBlank(parts)) { + throw new exceptions_1.BaseException(digits + " is not a valid digit info for number pipes"); + } + if (lang_1.isPresent(parts[1])) { + minInt = lang_1.NumberWrapper.parseIntAutoRadix(parts[1]); + } + if (lang_1.isPresent(parts[3])) { + minFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[3]); + } + if (lang_1.isPresent(parts[5])) { + maxFraction = lang_1.NumberWrapper.parseIntAutoRadix(parts[5]); + } + } + return intl_1.NumberFormatter.format(value, defaultLocale, style, { + minimumIntegerDigits: minInt, + minimumFractionDigits: minFraction, + maximumFractionDigits: maxFraction, + currency: currency, + currencyAsSymbol: currencyAsSymbol + }); + }; + NumberPipe = __decorate([lang_1.CONST(), di_1.Injectable(), __metadata('design:paramtypes', [])], NumberPipe); + return NumberPipe; + })(); + exports.NumberPipe = NumberPipe; + var DecimalPipe = (function(_super) { + __extends(DecimalPipe, _super); + function DecimalPipe() { + _super.apply(this, arguments); + } + DecimalPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Decimal, digits); + }; + DecimalPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'number'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DecimalPipe); + return DecimalPipe; + })(NumberPipe); + exports.DecimalPipe = DecimalPipe; + var PercentPipe = (function(_super) { + __extends(PercentPipe, _super); + function PercentPipe() { + _super.apply(this, arguments); + } + PercentPipe.prototype.transform = function(value, args) { + var digits = collection_1.ListWrapper.first(args); + return NumberPipe._format(value, intl_1.NumberFormatStyle.Percent, digits); + }; + PercentPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'percent'}), di_1.Injectable(), __metadata('design:paramtypes', [])], PercentPipe); + return PercentPipe; + })(NumberPipe); + exports.PercentPipe = PercentPipe; + var CurrencyPipe = (function(_super) { + __extends(CurrencyPipe, _super); + function CurrencyPipe() { + _super.apply(this, arguments); + } + CurrencyPipe.prototype.transform = function(value, args) { + var currencyCode = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'USD'; + var symbolDisplay = lang_1.isPresent(args) && args.length > 1 ? args[1] : false; + var digits = lang_1.isPresent(args) && args.length > 2 ? args[2] : null; + return NumberPipe._format(value, intl_1.NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); + }; + CurrencyPipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'currency'}), di_1.Injectable(), __metadata('design:paramtypes', [])], CurrencyPipe); + return CurrencyPipe; + })(NumberPipe); + exports.CurrencyPipe = CurrencyPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Type = lang_1.Type; + var async_1 = require("angular2/src/core/facade/async"); + exports.Observable = async_1.Observable; + exports.EventEmitter = async_1.EventEmitter; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.WrappedException = exceptions_1.WrappedException; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone/ng_zone", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var profile_1 = require("angular2/src/core/profile/profile"); + var NgZone = (function() { + function NgZone(_a) { + var enableLongStackTrace = _a.enableLongStackTrace; + this._runScope = profile_1.wtfCreateScope("NgZone#run()"); + this._microtaskScope = profile_1.wtfCreateScope("NgZone#microtask()"); + this._inVmTurnDone = false; + this._pendingTimeouts = []; + this._onTurnStart = null; + this._onTurnDone = null; + this._onEventDone = null; + this._onErrorHandler = null; + this._pendingMicrotasks = 0; + this._hasExecutedCodeInInnerZone = false; + this._nestedRun = 0; + if (lang_1.global.zone) { + this._disabled = false; + this._mountZone = lang_1.global.zone; + this._innerZone = this._createInnerZone(this._mountZone, enableLongStackTrace); + } else { + this._disabled = true; + this._mountZone = null; + } + } + NgZone.prototype.overrideOnTurnStart = function(onTurnStartHook) { + this._onTurnStart = lang_1.normalizeBlank(onTurnStartHook); + }; + NgZone.prototype.overrideOnTurnDone = function(onTurnDoneHook) { + this._onTurnDone = lang_1.normalizeBlank(onTurnDoneHook); + }; + NgZone.prototype.overrideOnEventDone = function(onEventDoneFn, opt_waitForAsync) { + var _this = this; + if (opt_waitForAsync === void 0) { + opt_waitForAsync = false; + } + var normalizedOnEventDone = lang_1.normalizeBlank(onEventDoneFn); + if (opt_waitForAsync) { + this._onEventDone = function() { + if (!_this._pendingTimeouts.length) { + normalizedOnEventDone(); + } + }; + } else { + this._onEventDone = normalizedOnEventDone; + } + }; + NgZone.prototype.overrideOnErrorHandler = function(errorHandler) { + this._onErrorHandler = lang_1.normalizeBlank(errorHandler); + }; + NgZone.prototype.run = function(fn) { + if (this._disabled) { + return fn(); + } else { + var s = this._runScope(); + try { + return this._innerZone.run(fn); + } finally { + profile_1.wtfLeave(s); + } + } + }; + NgZone.prototype.runOutsideAngular = function(fn) { + if (this._disabled) { + return fn(); + } else { + return this._mountZone.run(fn); + } + }; + NgZone.prototype._createInnerZone = function(zone, enableLongStackTrace) { + var microtaskScope = this._microtaskScope; + var ngZone = this; + var errorHandling; + if (enableLongStackTrace) { + errorHandling = collection_1.StringMapWrapper.merge(Zone.longStackTraceZone, {onError: function(e) { + ngZone._onError(this, e); + }}); + } else { + errorHandling = {onError: function(e) { + ngZone._onError(this, e); + }}; + } + return zone.fork(errorHandling).fork({ + '$run': function(parentRun) { + return function() { + try { + ngZone._nestedRun++; + if (!ngZone._hasExecutedCodeInInnerZone) { + ngZone._hasExecutedCodeInInnerZone = true; + if (ngZone._onTurnStart) { + parentRun.call(ngZone._innerZone, ngZone._onTurnStart); + } + } + return parentRun.apply(this, arguments); + } finally { + ngZone._nestedRun--; + if (ngZone._pendingMicrotasks == 0 && ngZone._nestedRun == 0 && !this._inVmTurnDone) { + if (ngZone._onTurnDone && ngZone._hasExecutedCodeInInnerZone) { + try { + this._inVmTurnDone = true; + parentRun.call(ngZone._innerZone, ngZone._onTurnDone); + } finally { + this._inVmTurnDone = false; + ngZone._hasExecutedCodeInInnerZone = false; + } + } + if (ngZone._pendingMicrotasks === 0 && lang_1.isPresent(ngZone._onEventDone)) { + ngZone.runOutsideAngular(ngZone._onEventDone); + } + } + } + }; + }, + '$scheduleMicrotask': function(parentScheduleMicrotask) { + return function(fn) { + ngZone._pendingMicrotasks++; + var microtask = function() { + var s = microtaskScope(); + try { + fn(); + } finally { + ngZone._pendingMicrotasks--; + profile_1.wtfLeave(s); + } + }; + parentScheduleMicrotask.call(this, microtask); + }; + }, + '$setTimeout': function(parentSetTimeout) { + return function(fn, delay) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var id; + var cb = function() { + fn(); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + id = parentSetTimeout(cb, delay, args); + ngZone._pendingTimeouts.push(id); + return id; + }; + }, + '$clearTimeout': function(parentClearTimeout) { + return function(id) { + parentClearTimeout(id); + collection_1.ListWrapper.remove(ngZone._pendingTimeouts, id); + }; + }, + _innerZone: true + }); + }; + NgZone.prototype._onError = function(zone, e) { + if (lang_1.isPresent(this._onErrorHandler)) { + var trace = [lang_1.normalizeBlank(e.stack)]; + while (zone && zone.constructedAtException) { + trace.push(zone.constructedAtException.get()); + zone = zone.parent; + } + this._onErrorHandler(e, trace); + } else { + console.log('## _onError ##'); + console.log(e.stack); + throw e; + } + }; + return NgZone; + })(); + exports.NgZone = NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.APP_COMPONENT_REF_PROMISE = lang_1.CONST_EXPR(new di_1.OpaqueToken('Promise')); + exports.APP_COMPONENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppComponent')); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/dom/dom_adapter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + exports.DOM; + function setRootDomAdapter(adapter) { + if (lang_1.isBlank(exports.DOM)) { + exports.DOM = adapter; + } + } + exports.setRootDomAdapter = setRootDomAdapter; + function _abstract() { + return new exceptions_1.BaseException('This method is abstract'); + } + var DomAdapter = (function() { + function DomAdapter() {} + DomAdapter.prototype.hasProperty = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setProperty = function(el, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getProperty = function(el, name) { + throw _abstract(); + }; + DomAdapter.prototype.invoke = function(el, methodName, args) { + throw _abstract(); + }; + DomAdapter.prototype.logError = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.log = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroup = function(error) { + throw _abstract(); + }; + DomAdapter.prototype.logGroupEnd = function() { + throw _abstract(); + }; + Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { + get: function() { + throw _abstract(); + }, + enumerable: true, + configurable: true + }); + DomAdapter.prototype.parse = function(templateHtml) { + throw _abstract(); + }; + DomAdapter.prototype.query = function(selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelector = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.querySelectorAll = function(el, selector) { + throw _abstract(); + }; + DomAdapter.prototype.on = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.onAndCancel = function(el, evt, listener) { + throw _abstract(); + }; + DomAdapter.prototype.dispatchEvent = function(el, evt) { + throw _abstract(); + }; + DomAdapter.prototype.createMouseEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.createEvent = function(eventType) { + throw _abstract(); + }; + DomAdapter.prototype.preventDefault = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.isPrevented = function(evt) { + throw _abstract(); + }; + DomAdapter.prototype.getInnerHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getOuterHTML = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nodeName = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.nodeValue = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.type = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.content = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.firstChild = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.nextSibling = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.parentElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.childNodesAsList = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clearNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.appendChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.removeChild = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.replaceChild = function(el, newNode, oldNode) { + throw _abstract(); + }; + DomAdapter.prototype.remove = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.insertBefore = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.insertAllBefore = function(el, nodes) { + throw _abstract(); + }; + DomAdapter.prototype.insertAfter = function(el, node) { + throw _abstract(); + }; + DomAdapter.prototype.setInnerHTML = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getText = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setText = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getValue = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setValue = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.getChecked = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.setChecked = function(el, value) { + throw _abstract(); + }; + DomAdapter.prototype.createComment = function(text) { + throw _abstract(); + }; + DomAdapter.prototype.createTemplate = function(html) { + throw _abstract(); + }; + DomAdapter.prototype.createElement = function(tagName, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createTextNode = function(text, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createScriptTag = function(attrName, attrValue, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createStyleElement = function(css, doc) { + if (doc === void 0) { + doc = null; + } + throw _abstract(); + }; + DomAdapter.prototype.createShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getShadowRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getHost = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getDistributedNodes = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.clone = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByClassName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.getElementsByTagName = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.classList = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.addClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.removeClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.hasClass = function(element, classname) { + throw _abstract(); + }; + DomAdapter.prototype.setStyle = function(element, stylename, stylevalue) { + throw _abstract(); + }; + DomAdapter.prototype.removeStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.getStyle = function(element, stylename) { + throw _abstract(); + }; + DomAdapter.prototype.tagName = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.attributeMap = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.hasAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.getAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.setAttribute = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.removeAttribute = function(element, attribute) { + throw _abstract(); + }; + DomAdapter.prototype.templateAwareRoot = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.createHtmlDocument = function() { + throw _abstract(); + }; + DomAdapter.prototype.defaultDoc = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBoundingClientRect = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.getTitle = function() { + throw _abstract(); + }; + DomAdapter.prototype.setTitle = function(newTitle) { + throw _abstract(); + }; + DomAdapter.prototype.elementMatches = function(n, selector) { + throw _abstract(); + }; + DomAdapter.prototype.isTemplateElement = function(el) { + throw _abstract(); + }; + DomAdapter.prototype.isTextNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isCommentNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isElementNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.hasShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isShadowRoot = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.importIntoDoc = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.adoptNode = function(node) { + throw _abstract(); + }; + DomAdapter.prototype.isPageRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isStyleRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isMediaRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.isKeyframesRule = function(rule) { + throw _abstract(); + }; + DomAdapter.prototype.getHref = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getEventKey = function(event) { + throw _abstract(); + }; + DomAdapter.prototype.resolveAndSetHref = function(element, baseUrl, href) { + throw _abstract(); + }; + DomAdapter.prototype.cssToRules = function(css) { + throw _abstract(); + }; + DomAdapter.prototype.supportsDOMEvents = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsNativeShadowDOM = function() { + throw _abstract(); + }; + DomAdapter.prototype.getGlobalEventTarget = function(target) { + throw _abstract(); + }; + DomAdapter.prototype.getHistory = function() { + throw _abstract(); + }; + DomAdapter.prototype.getLocation = function() { + throw _abstract(); + }; + DomAdapter.prototype.getBaseHref = function() { + throw _abstract(); + }; + DomAdapter.prototype.resetBaseElement = function() { + throw _abstract(); + }; + DomAdapter.prototype.getUserAgent = function() { + throw _abstract(); + }; + DomAdapter.prototype.setData = function(element, name, value) { + throw _abstract(); + }; + DomAdapter.prototype.getComputedStyle = function(element) { + throw _abstract(); + }; + DomAdapter.prototype.getData = function(element, name) { + throw _abstract(); + }; + DomAdapter.prototype.setGlobalVar = function(name, value) { + throw _abstract(); + }; + DomAdapter.prototype.requestAnimationFrame = function(callback) { + throw _abstract(); + }; + DomAdapter.prototype.cancelAnimationFrame = function(id) { + throw _abstract(); + }; + DomAdapter.prototype.performanceNow = function() { + throw _abstract(); + }; + DomAdapter.prototype.getAnimationPrefix = function() { + throw _abstract(); + }; + DomAdapter.prototype.getTransitionEnd = function() { + throw _abstract(); + }; + DomAdapter.prototype.supportsAnimation = function() { + throw _abstract(); + }; + return DomAdapter; + })(); + exports.DomAdapter = DomAdapter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var DirectiveResolver = (function() { + function DirectiveResolver() {} + DirectiveResolver.prototype.resolve = function(type) { + var typeMetadata = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(typeMetadata)) { + for (var i = 0; i < typeMetadata.length; i++) { + var metadata = typeMetadata[i]; + if (metadata instanceof metadata_1.DirectiveMetadata) { + var propertyMetadata = reflection_1.reflector.propMetadata(type); + return this._mergeWithPropertyMetadata(metadata, propertyMetadata); + } + } + } + throw new exceptions_1.BaseException("No Directive annotation found on " + lang_1.stringify(type)); + }; + DirectiveResolver.prototype._mergeWithPropertyMetadata = function(dm, propertyMetadata) { + var properties = []; + var events = []; + var host = {}; + var queries = {}; + collection_1.StringMapWrapper.forEach(propertyMetadata, function(metadata, propName) { + metadata.forEach(function(a) { + if (a instanceof metadata_1.PropertyMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + properties.push(propName + ": " + a.bindingPropertyName); + } else { + properties.push(propName); + } + } + if (a instanceof metadata_1.EventMetadata) { + if (lang_1.isPresent(a.bindingPropertyName)) { + events.push(propName + ": " + a.bindingPropertyName); + } else { + events.push(propName); + } + } + if (a instanceof metadata_1.HostBindingMetadata) { + if (lang_1.isPresent(a.hostPropertyName)) { + host[("[" + a.hostPropertyName + "]")] = propName; + } else { + host[("[" + propName + "]")] = propName; + } + } + if (a instanceof metadata_1.HostListenerMetadata) { + var args = lang_1.isPresent(a.args) ? a.args.join(', ') : ''; + host[("(" + a.eventName + ")")] = propName + "(" + args + ")"; + } + if (a instanceof metadata_1.ContentChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildrenMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ContentChildMetadata) { + queries[propName] = a; + } + if (a instanceof metadata_1.ViewChildMetadata) { + queries[propName] = a; + } + }); + }); + return this._merge(dm, properties, events, host, queries); + }; + DirectiveResolver.prototype._merge = function(dm, properties, events, host, queries) { + var mergedProperties = lang_1.isPresent(dm.properties) ? collection_1.ListWrapper.concat(dm.properties, properties) : properties; + var mergedEvents = lang_1.isPresent(dm.events) ? collection_1.ListWrapper.concat(dm.events, events) : events; + var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host; + var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries; + if (dm instanceof metadata_1.ComponentMetadata) { + return new metadata_1.ComponentMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries, + changeDetection: dm.changeDetection, + viewBindings: dm.viewBindings + }); + } else { + return new metadata_1.DirectiveMetadata({ + selector: dm.selector, + properties: mergedProperties, + events: mergedEvents, + host: mergedHost, + bindings: dm.bindings, + exportAs: dm.exportAs, + moduleId: dm.moduleId, + compileChildren: dm.compileChildren, + queries: mergedQueries + }); + } + }; + DirectiveResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DirectiveResolver); + return DirectiveResolver; + })(); + exports.DirectiveResolver = DirectiveResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_binder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementBinder = (function() { + function ElementBinder(index, parent, distanceToParent, protoElementInjector, componentDirective) { + this.index = index; + this.parent = parent; + this.distanceToParent = distanceToParent; + this.protoElementInjector = protoElementInjector; + this.componentDirective = componentDirective; + this.nestedProtoView = null; + if (lang_1.isBlank(index)) { + throw new exceptions_1.BaseException('null index not allowed.'); + } + } + ElementBinder.prototype.hasStaticComponent = function() { + return lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + ElementBinder.prototype.hasEmbeddedProtoView = function() { + return !lang_1.isPresent(this.componentDirective) && lang_1.isPresent(this.nestedProtoView); + }; + return ElementBinder; + })(); + exports.ElementBinder = ElementBinder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_ref", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function internalView(viewRef) { + return viewRef._view; + } + exports.internalView = internalView; + function internalProtoView(protoViewRef) { + return lang_1.isPresent(protoViewRef) ? protoViewRef._protoView : null; + } + exports.internalProtoView = internalProtoView; + var ViewRef = (function() { + function ViewRef(_view) { + this._view = _view; + this._changeDetectorRef = null; + } + Object.defineProperty(ViewRef.prototype, "render", { + get: function() { + return this._view.render; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "renderFragment", { + get: function() { + return this._view.renderFragment; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ViewRef.prototype, "changeDetectorRef", { + get: function() { + if (this._changeDetectorRef === null) { + this._changeDetectorRef = this._view.changeDetector.ref; + } + return this._changeDetectorRef; + }, + set: function(value) { + throw "readonly"; + }, + enumerable: true, + configurable: true + }); + ViewRef.prototype.setLocal = function(contextName, value) { + this._view.setLocal(contextName, value); + }; + return ViewRef; + })(); + exports.ViewRef = ViewRef; + var ProtoViewRef = (function() { + function ProtoViewRef(_protoView) { + this._protoView = _protoView; + } + return ProtoViewRef; + })(); + exports.ProtoViewRef = ProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/util", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + exports.NG_BINDING_CLASS_SELECTOR = '.ng-binding'; + exports.NG_BINDING_CLASS = 'ng-binding'; + exports.NG_CONTENT_ELEMENT_NAME = 'ng-content'; + exports.NG_SHADOW_ROOT_ELEMENT_NAME = 'shadow-root'; + var MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = 20; + 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; + function queryBoundElements(templateContent, isSingleElementChild) { + var result; + var dynamicElementList; + var elementIdx = 0; + if (isSingleElementChild) { + var rootElement = dom_adapter_1.DOM.firstChild(templateContent); + var rootHasBinding = dom_adapter_1.DOM.hasClass(rootElement, exports.NG_BINDING_CLASS); + dynamicElementList = dom_adapter_1.DOM.getElementsByClassName(rootElement, exports.NG_BINDING_CLASS); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length + (rootHasBinding ? 1 : 0)); + if (rootHasBinding) { + result[elementIdx++] = rootElement; + } + } else { + dynamicElementList = dom_adapter_1.DOM.querySelectorAll(templateContent, exports.NG_BINDING_CLASS_SELECTOR); + result = collection_1.ListWrapper.createFixedSize(dynamicElementList.length); + } + for (var i = 0; i < dynamicElementList.length; i++) { + result[elementIdx++] = dynamicElementList[i]; + } + return result; + } + exports.queryBoundElements = queryBoundElements; + var ClonedProtoView = (function() { + function ClonedProtoView(original, fragments, boundElements, boundTextNodes) { + this.original = original; + this.fragments = fragments; + this.boundElements = boundElements; + this.boundTextNodes = boundTextNodes; + } + return ClonedProtoView; + })(); + exports.ClonedProtoView = ClonedProtoView; + function cloneAndQueryProtoView(templateCloner, pv, importIntoDocument) { + var templateContent = templateCloner.cloneContent(pv.cloneableTemplate, importIntoDocument); + var boundElements = queryBoundElements(templateContent, pv.isSingleElementFragment); + var boundTextNodes = queryBoundTextNodes(templateContent, pv.rootTextNodeIndices, boundElements, pv.elementBinders, pv.boundTextNodeCount); + var fragments = queryFragments(templateContent, pv.fragmentsRootNodeCount); + return new ClonedProtoView(pv, fragments, boundElements, boundTextNodes); + } + exports.cloneAndQueryProtoView = cloneAndQueryProtoView; + function queryFragments(templateContent, fragmentsRootNodeCount) { + var fragments = collection_1.ListWrapper.createGrowableSize(fragmentsRootNodeCount.length); + var childNode = dom_adapter_1.DOM.firstChild(templateContent); + for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) { + var fragment = collection_1.ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]); + fragments[fragmentIndex] = fragment; + if (fragmentIndex >= 1) { + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + for (var i = 0; i < fragment.length; i++) { + fragment[i] = childNode; + childNode = dom_adapter_1.DOM.nextSibling(childNode); + } + } + return fragments; + } + function queryBoundTextNodes(templateContent, rootTextNodeIndices, boundElements, elementBinders, boundTextNodeCount) { + var boundTextNodes = collection_1.ListWrapper.createFixedSize(boundTextNodeCount); + var textNodeIndex = 0; + if (rootTextNodeIndices.length > 0) { + var rootChildNodes = dom_adapter_1.DOM.childNodes(templateContent); + for (var i = 0; i < rootTextNodeIndices.length; i++) { + boundTextNodes[textNodeIndex++] = rootChildNodes[rootTextNodeIndices[i]]; + } + } + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + var element = boundElements[i]; + if (binder.textNodeIndices.length > 0) { + var childNodes = dom_adapter_1.DOM.childNodes(element); + for (var j = 0; j < binder.textNodeIndices.length; j++) { + boundTextNodes[textNodeIndex++] = childNodes[binder.textNodeIndices[j]]; + } + } + } + return boundTextNodes; + } + function isElementWithTag(node, elementName) { + return dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.tagName(node).toLowerCase() == elementName.toLowerCase(); + } + exports.isElementWithTag = isElementWithTag; + function queryBoundTextNodeIndices(parentNode, boundTextNodes, resultCallback) { + var childNodes = dom_adapter_1.DOM.childNodes(parentNode); + for (var j = 0; j < childNodes.length; j++) { + var node = childNodes[j]; + if (boundTextNodes.has(node)) { + resultCallback(node, j, boundTextNodes.get(node)); + } + } + } + exports.queryBoundTextNodeIndices = queryBoundTextNodeIndices; + function prependAll(parentNode, nodes) { + var lastInsertedNode = null; + nodes.forEach(function(node) { + if (lang_1.isBlank(lastInsertedNode)) { + var firstChild = dom_adapter_1.DOM.firstChild(parentNode); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, node); + } else { + dom_adapter_1.DOM.appendChild(parentNode, node); + } + } else { + dom_adapter_1.DOM.insertAfter(lastInsertedNode, node); + } + lastInsertedNode = node; + }); + } + exports.prependAll = prependAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_ref", ["angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ElementRef = (function() { + function ElementRef(parentView, boundElementIndex, renderBoundElementIndex, _renderer) { + this._renderer = _renderer; + this.parentView = parentView; + this.boundElementIndex = boundElementIndex; + this.renderBoundElementIndex = renderBoundElementIndex; + } + Object.defineProperty(ElementRef.prototype, "renderView", { + get: function() { + return this.parentView.render; + }, + set: function(viewRef) { + throw new exceptions_1.BaseException('Abstract setter'); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ElementRef.prototype, "nativeElement", { + get: function() { + return this._renderer.getNativeElementSync(this); + }, + enumerable: true, + configurable: true + }); + return ElementRef; + })(); + exports.ElementRef = ElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_ref", ["angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var TemplateRef = (function() { + function TemplateRef(elementRef) { + this.elementRef = elementRef; + } + TemplateRef.prototype._getProtoView = function() { + var parentView = view_ref_1.internalView(this.elementRef.parentView); + return parentView.proto.elementBinders[this.elementRef.boundElementIndex - parentView.elementOffset].nestedProtoView; + }; + Object.defineProperty(TemplateRef.prototype, "protoViewRef", { + get: function() { + return this._getProtoView().ref; + }, + enumerable: true, + configurable: true + }); + TemplateRef.prototype.hasLocal = function(name) { + return this._getProtoView().variableBindings.has(name); + }; + return TemplateRef; + })(); + exports.TemplateRef = TemplateRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/pipes", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var SelectedPipe = (function() { + function SelectedPipe(pipe, pure) { + this.pipe = pipe; + this.pure = pure; + } + return SelectedPipe; + })(); + exports.SelectedPipe = SelectedPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_pool", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.APP_VIEW_POOL_CAPACITY = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppViewPool.viewPoolCapacity')); + var AppViewPool = (function() { + function AppViewPool(poolCapacityPerProtoView) { + this._pooledViewsPerProtoView = new collection_1.Map(); + this._poolCapacityPerProtoView = poolCapacityPerProtoView; + } + AppViewPool.prototype.getView = function(protoView) { + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isPresent(pooledViews) && pooledViews.length > 0) { + return collection_1.ListWrapper.removeLast(pooledViews); + } + return null; + }; + AppViewPool.prototype.returnView = function(view) { + var protoView = view.proto; + var pooledViews = this._pooledViewsPerProtoView.get(protoView); + if (lang_1.isBlank(pooledViews)) { + pooledViews = []; + this._pooledViewsPerProtoView.set(protoView, pooledViews); + } + var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; + if (haveRemainingCapacity) { + pooledViews.push(view); + } + return haveRemainingCapacity; + }; + AppViewPool = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.APP_VIEW_POOL_CAPACITY)), __metadata('design:paramtypes', [Object])], AppViewPool); + return AppViewPool; + })(); + exports.AppViewPool = AppViewPool; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_listener", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppViewListener = (function() { + function AppViewListener() {} + AppViewListener.prototype.viewCreated = function(view) {}; + AppViewListener.prototype.viewDestroyed = function(view) {}; + AppViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewListener); + return AppViewListener; + })(); + exports.AppViewListener = AppViewListener; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_container_ref", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var ViewContainerRef = (function() { + function ViewContainerRef(viewManager, element) { + this.viewManager = viewManager; + this.element = element; + } + ViewContainerRef.prototype._getViews = function() { + var vc = view_ref_1.internalView(this.element.parentView).viewContainers[this.element.boundElementIndex]; + return lang_1.isPresent(vc) ? vc.views : []; + }; + ViewContainerRef.prototype.clear = function() { + for (var i = this.length - 1; i >= 0; i--) { + this.remove(i); + } + }; + ViewContainerRef.prototype.get = function(index) { + return this._getViews()[index].ref; + }; + Object.defineProperty(ViewContainerRef.prototype, "length", { + get: function() { + return this._getViews().length; + }, + enumerable: true, + configurable: true + }); + ViewContainerRef.prototype.createEmbeddedView = function(templateRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createEmbeddedViewInContainer(this.element, atIndex, templateRef); + }; + ViewContainerRef.prototype.createHostView = function(protoViewRef, atIndex, dynamicallyCreatedBindings) { + if (protoViewRef === void 0) { + protoViewRef = null; + } + if (atIndex === void 0) { + atIndex = -1; + } + if (dynamicallyCreatedBindings === void 0) { + dynamicallyCreatedBindings = null; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.createHostViewInContainer(this.element, atIndex, protoViewRef, dynamicallyCreatedBindings); + }; + ViewContainerRef.prototype.insert = function(viewRef, atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length; + return this.viewManager.attachViewInContainer(this.element, atIndex, viewRef); + }; + ViewContainerRef.prototype.indexOf = function(viewRef) { + return collection_1.ListWrapper.indexOf(this._getViews(), view_ref_1.internalView(viewRef)); + }; + ViewContainerRef.prototype.remove = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + this.viewManager.destroyViewInContainer(this.element, atIndex); + }; + ViewContainerRef.prototype.detach = function(atIndex) { + if (atIndex === void 0) { + atIndex = -1; + } + if (atIndex == -1) + atIndex = this.length - 1; + return this.viewManager.detachViewInContainer(this.element, atIndex); + }; + return ViewContainerRef; + })(); + exports.ViewContainerRef = ViewContainerRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/interfaces", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + (function(LifecycleHooks) { + LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; + LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; + LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; + LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; + LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; + LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; + LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; + LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; + })(exports.LifecycleHooks || (exports.LifecycleHooks = {})); + var LifecycleHooks = exports.LifecycleHooks; + exports.LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/query_list", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var QueryList = (function() { + function QueryList() { + this._results = []; + this._callbacks = []; + this._dirty = false; + } + QueryList.prototype.reset = function(newList) { + this._results = newList; + this._dirty = true; + }; + QueryList.prototype.add = function(obj) { + this._results.push(obj); + this._dirty = true; + }; + QueryList.prototype.onChange = function(callback) { + this._callbacks.push(callback); + }; + QueryList.prototype.removeCallback = function(callback) { + collection_1.ListWrapper.remove(this._callbacks, callback); + }; + QueryList.prototype.removeAllCallbacks = function() { + this._callbacks = []; + }; + QueryList.prototype.toString = function() { + return this._results.toString(); + }; + Object.defineProperty(QueryList.prototype, "length", { + get: function() { + return this._results.length; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "first", { + get: function() { + return collection_1.ListWrapper.first(this._results); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(QueryList.prototype, "last", { + get: function() { + return collection_1.ListWrapper.last(this._results); + }, + enumerable: true, + configurable: true + }); + QueryList.prototype.map = function(fn) { + return this._results.map(fn); + }; + QueryList.prototype[lang_1.getSymbolIterator()] = function() { + return this._results[lang_1.getSymbolIterator()](); + }; + QueryList.prototype.fireCallbacks = function() { + if (this._dirty) { + collection_1.ListWrapper.forEach(this._callbacks, function(c) { + return c(); + }); + this._dirty = false; + } + }; + return QueryList; + })(); + exports.QueryList = QueryList; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/event_config", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.EVENT_TARGET_SEPARATOR = ':'; + var EventConfig = (function() { + function EventConfig(fieldName, eventName, isLongForm) { + this.fieldName = fieldName; + this.eventName = eventName; + this.isLongForm = isLongForm; + } + EventConfig.parse = function(eventConfig) { + var fieldName = eventConfig, + eventName = eventConfig, + isLongForm = false; + var separatorIdx = eventConfig.indexOf(exports.EVENT_TARGET_SEPARATOR); + if (separatorIdx > -1) { + fieldName = lang_1.StringWrapper.substring(eventConfig, 0, separatorIdx).trim(); + eventName = lang_1.StringWrapper.substring(eventConfig, separatorIdx + 1).trim(); + isLongForm = true; + } + return new EventConfig(fieldName, eventName, isLongForm); + }; + EventConfig.prototype.getFullName = function() { + return this.isLongForm ? "" + this.fieldName + exports.EVENT_TARGET_SEPARATOR + this.eventName : this.eventName; + }; + return EventConfig; + })(); + exports.EventConfig = EventConfig; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipe_binding", ["angular2/src/core/di/binding", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var binding_1 = require("angular2/src/core/di/binding"); + var di_1 = require("angular2/src/core/di"); + var PipeBinding = (function(_super) { + __extends(PipeBinding, _super); + function PipeBinding(name, pure, key, resolvedFactories, multiBinding) { + _super.call(this, key, resolvedFactories, multiBinding); + this.name = name; + this.pure = pure; + } + PipeBinding.createFromType = function(type, metadata) { + var binding = new di_1.Binding(type, {toClass: type}); + var rb = binding_1.resolveBinding(binding); + return new PipeBinding(metadata.name, metadata.pure, rb.key, rb.resolvedFactories, rb.multiBinding); + }; + return PipeBinding; + })(di_1.ResolvedBinding); + exports.PipeBinding = PipeBinding; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_resolver", ["angular2/src/core/di", "angular2/src/core/metadata/view", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 view_1 = require("angular2/src/core/metadata/view"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ViewResolver = (function() { + function ViewResolver() { + this._cache = new collection_1.Map(); + } + ViewResolver.prototype.resolve = function(component) { + var view = this._cache.get(component); + if (lang_1.isBlank(view)) { + view = this._resolve(component); + this._cache.set(component, view); + } + return view; + }; + ViewResolver.prototype._resolve = function(component) { + var annotations = reflection_1.reflector.annotations(component); + for (var i = 0; i < annotations.length; i++) { + var annotation = annotations[i]; + if (annotation instanceof view_1.ViewMetadata) { + return annotation; + } + } + throw new exceptions_1.BaseException("No View annotation found on component " + lang_1.stringify(component)); + }; + ViewResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ViewResolver); + return ViewResolver; + })(); + exports.ViewResolver = ViewResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/pipe_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/metadata", "angular2/src/core/reflection/reflection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var metadata_1 = require("angular2/src/core/metadata"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var PipeResolver = (function() { + function PipeResolver() {} + PipeResolver.prototype.resolve = function(type) { + var metas = reflection_1.reflector.annotations(di_1.resolveForwardRef(type)); + if (lang_1.isPresent(metas)) { + for (var i = 0; i < metas.length; i++) { + var annotation = metas[i]; + if (annotation instanceof metadata_1.PipeMetadata) { + return annotation; + } + } + } + throw new exceptions_1.BaseException("No Pipe decorator found on " + lang_1.stringify(type)); + }; + PipeResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], PipeResolver); + return PipeResolver; + })(); + exports.PipeResolver = PipeResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/component_url_mapper", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var ComponentUrlMapper = (function() { + function ComponentUrlMapper() {} + ComponentUrlMapper.prototype.getUrl = function(component) { + return reflection_1.reflector.isReflectionEnabled() ? reflection_1.reflector.importUri(component) : './'; + }; + ComponentUrlMapper = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], ComponentUrlMapper); + return ComponentUrlMapper; + })(); + exports.ComponentUrlMapper = ComponentUrlMapper; + var RuntimeComponentUrlMapper = (function(_super) { + __extends(RuntimeComponentUrlMapper, _super); + function RuntimeComponentUrlMapper() { + _super.call(this); + this._componentUrls = new collection_1.Map(); + } + RuntimeComponentUrlMapper.prototype.setComponentUrl = function(component, url) { + this._componentUrls.set(component, url); + }; + RuntimeComponentUrlMapper.prototype.getUrl = function(component) { + var url = this._componentUrls.get(component); + if (lang_1.isPresent(url)) + return url; + return _super.prototype.getUrl.call(this, component); + }; + return RuntimeComponentUrlMapper; + })(ComponentUrlMapper); + exports.RuntimeComponentUrlMapper = RuntimeComponentUrlMapper; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/proto_view_factory", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var BindingRecordsCreator = (function() { + function BindingRecordsCreator() { + this._directiveRecordsMap = new Map(); + } + BindingRecordsCreator.prototype.getEventBindingRecords = function(elementBinders, allDirectiveMetadatas) { + var res = []; + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createTemplateEventRecords(res, renderElementBinder, boundElementIndex); + this._createHostEventRecords(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex); + } + return res; + }; + BindingRecordsCreator.prototype._createTemplateEventRecords = function(res, renderElementBinder, boundElementIndex) { + renderElementBinder.eventBindings.forEach(function(eb) { + res.push(change_detection_1.BindingRecord.createForEvent(eb.source, eb.fullName, boundElementIndex)); + }); + }; + BindingRecordsCreator.prototype._createHostEventRecords = function(res, renderElementBinder, allDirectiveMetadatas, boundElementIndex) { + for (var i = 0; i < renderElementBinder.directives.length; ++i) { + var dir = renderElementBinder.directives[i]; + var directiveMetadata = allDirectiveMetadatas[dir.directiveIndex]; + var dirRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + dir.eventBindings.forEach(function(heb) { + res.push(change_detection_1.BindingRecord.createForHostEvent(heb.source, heb.fullName, dirRecord)); + }); + } + }; + BindingRecordsCreator.prototype.getPropertyBindingRecords = function(textBindings, elementBinders, allDirectiveMetadatas) { + var bindings = []; + this._createTextNodeRecords(bindings, textBindings); + for (var boundElementIndex = 0; boundElementIndex < elementBinders.length; boundElementIndex++) { + var renderElementBinder = elementBinders[boundElementIndex]; + this._createElementPropertyRecords(bindings, boundElementIndex, renderElementBinder); + this._createDirectiveRecords(bindings, boundElementIndex, renderElementBinder.directives, allDirectiveMetadatas); + } + return bindings; + }; + BindingRecordsCreator.prototype.getDirectiveRecords = function(elementBinders, allDirectiveMetadatas) { + var directiveRecords = []; + for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { + var dirs = elementBinders[elementIndex].directives; + for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { + directiveRecords.push(this._getDirectiveRecord(elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + } + } + return directiveRecords; + }; + BindingRecordsCreator.prototype._createTextNodeRecords = function(bindings, textBindings) { + for (var i = 0; i < textBindings.length; i++) { + bindings.push(change_detection_1.BindingRecord.createForTextNode(textBindings[i], i)); + } + }; + BindingRecordsCreator.prototype._createElementPropertyRecords = function(bindings, boundElementIndex, renderElementBinder) { + collection_1.ListWrapper.forEach(renderElementBinder.propertyBindings, function(binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForElementProperty(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForElementAttribute(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForElementClass(binding.astWithSource, boundElementIndex, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForElementStyle(binding.astWithSource, boundElementIndex, binding.property, binding.unit)); + } + }); + }; + BindingRecordsCreator.prototype._createDirectiveRecords = function(bindings, boundElementIndex, directiveBinders, allDirectiveMetadatas) { + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + var directiveMetadata = allDirectiveMetadatas[directiveBinder.directiveIndex]; + var directiveRecord = this._getDirectiveRecord(boundElementIndex, i, directiveMetadata); + collection_1.MapWrapper.forEach(directiveBinder.propertyBindings, function(astWithSource, propertyName) { + var setter = reflection_1.reflector.setter(propertyName); + bindings.push(change_detection_1.BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); + }); + if (directiveRecord.callOnChanges) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindings.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindings.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + } + for (var i = 0; i < directiveBinders.length; i++) { + var directiveBinder = directiveBinders[i]; + collection_1.ListWrapper.forEach(directiveBinder.hostPropertyBindings, function(binding) { + var dirIndex = new change_detection_1.DirectiveIndex(boundElementIndex, i); + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + bindings.push(change_detection_1.BindingRecord.createForHostProperty(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.ATTRIBUTE) { + bindings.push(change_detection_1.BindingRecord.createForHostAttribute(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.CLASS) { + bindings.push(change_detection_1.BindingRecord.createForHostClass(dirIndex, binding.astWithSource, binding.property)); + } else if (binding.type === api_1.PropertyBindingType.STYLE) { + bindings.push(change_detection_1.BindingRecord.createForHostStyle(dirIndex, binding.astWithSource, binding.property, binding.unit)); + } + }); + } + }; + BindingRecordsCreator.prototype._getDirectiveRecord = function(boundElementIndex, directiveIndex, directiveMetadata) { + var id = boundElementIndex * 100 + directiveIndex; + if (!this._directiveRecordsMap.has(id)) { + this._directiveRecordsMap.set(id, new change_detection_1.DirectiveRecord({ + directiveIndex: new change_detection_1.DirectiveIndex(boundElementIndex, directiveIndex), + callAfterContentInit: directiveMetadata.callAfterContentInit, + callAfterContentChecked: directiveMetadata.callAfterContentChecked, + callAfterViewInit: directiveMetadata.callAfterViewInit, + callAfterViewChecked: directiveMetadata.callAfterViewChecked, + callOnChanges: directiveMetadata.callOnChanges, + callDoCheck: directiveMetadata.callDoCheck, + callOnInit: directiveMetadata.callOnInit, + changeDetection: directiveMetadata.changeDetection + })); + } + return this._directiveRecordsMap.get(id); + }; + return BindingRecordsCreator; + })(); + exports.BindingRecordsCreator = BindingRecordsCreator; + var ProtoViewFactory = (function() { + function ProtoViewFactory(_changeDetection) { + this._changeDetection = _changeDetection; + } + ProtoViewFactory.prototype.createAppProtoViews = function(hostComponentBinding, rootRenderProtoView, allDirectives, pipes) { + var allRenderDirectiveMetadata = collection_1.ListWrapper.map(allDirectives, function(directiveBinding) { + return directiveBinding.metadata; + }); + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableBindings = _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + var protoChangeDetectors = this._getProtoChangeDetectors(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata); + var appProtoViews = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var appProtoView = _createAppProtoView(pvWithIndex.renderProtoView, protoChangeDetectors[pvWithIndex.index], nestedPvVariableBindings[pvWithIndex.index], allDirectives, pipes); + if (lang_1.isPresent(pvWithIndex.parentIndex)) { + var parentView = appProtoViews[pvWithIndex.parentIndex]; + parentView.elementBinders[pvWithIndex.boundElementIndex].nestedProtoView = appProtoView; + } + appProtoViews[pvWithIndex.index] = appProtoView; + }); + return appProtoViews; + }; + ProtoViewFactory.prototype._getProtoChangeDetectors = function(hostComponentBinding, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata) { + var _this = this; + if (this._changeDetection.generateDetectors) { + var changeDetectorDefs = _getChangeDetectorDefinitions(hostComponentBinding.metadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, this._changeDetection.genConfig); + return changeDetectorDefs.map(function(changeDetectorDef) { + return _this._changeDetection.getProtoChangeDetector(changeDetectorDef.id, changeDetectorDef); + }); + } else { + var changeDetectorIds = _getChangeDetectorDefinitionIds(hostComponentBinding.metadata, nestedPvsWithIndex); + return changeDetectorIds.map(function(id) { + return _this._changeDetection.getProtoChangeDetector(id, null); + }); + } + }; + ProtoViewFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetection])], ProtoViewFactory); + return ProtoViewFactory; + })(); + exports.ProtoViewFactory = ProtoViewFactory; + function getChangeDetectorDefinitions(hostComponentMetadata, rootRenderProtoView, allRenderDirectiveMetadata, genConfig) { + var nestedPvsWithIndex = _collectNestedProtoViews(rootRenderProtoView); + var nestedPvVariableNames = _collectNestedProtoViewsVariableNames(nestedPvsWithIndex); + return _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig); + } + exports.getChangeDetectorDefinitions = getChangeDetectorDefinitions; + function _collectNestedProtoViews(renderProtoView, parentIndex, boundElementIndex, result) { + if (parentIndex === void 0) { + parentIndex = null; + } + if (boundElementIndex === void 0) { + boundElementIndex = null; + } + if (result === void 0) { + result = null; + } + if (lang_1.isBlank(result)) { + result = []; + } + result.push(new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); + var currentIndex = result.length - 1; + var childBoundElementIndex = 0; + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(elementBinder) { + if (lang_1.isPresent(elementBinder.nestedProtoView)) { + _collectNestedProtoViews(elementBinder.nestedProtoView, currentIndex, childBoundElementIndex, result); + } + childBoundElementIndex++; + }); + return result; + } + function _getChangeDetectorDefinitions(hostComponentMetadata, nestedPvsWithIndex, nestedPvVariableNames, allRenderDirectiveMetadata, genConfig) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + var elementBinders = pvWithIndex.renderProtoView.elementBinders; + var bindingRecordsCreator = new BindingRecordsCreator(); + var propBindingRecords = bindingRecordsCreator.getPropertyBindingRecords(pvWithIndex.renderProtoView.textBindings, elementBinders, allRenderDirectiveMetadata); + var eventBindingRecords = bindingRecordsCreator.getEventBindingRecords(elementBinders, allRenderDirectiveMetadata); + var directiveRecords = bindingRecordsCreator.getDirectiveRecords(elementBinders, allRenderDirectiveMetadata); + var strategyName = change_detection_1.ChangeDetectionStrategy.Default; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + strategyName = hostComponentMetadata.changeDetection; + } + var id = _protoViewId(hostComponentMetadata, pvWithIndex); + var variableNames = nestedPvVariableNames[pvWithIndex.index]; + return new change_detection_1.ChangeDetectorDefinition(id, strategyName, variableNames, propBindingRecords, eventBindingRecords, directiveRecords, genConfig); + }); + } + function _getChangeDetectorDefinitionIds(hostComponentMetadata, nestedPvsWithIndex) { + return nestedPvsWithIndex.map(function(pvWithIndex) { + return _protoViewId(hostComponentMetadata, pvWithIndex); + }); + } + function _protoViewId(hostComponentMetadata, pvWithIndex) { + var typeString; + if (pvWithIndex.renderProtoView.type === api_1.ViewType.COMPONENT) { + typeString = 'comp'; + } else if (pvWithIndex.renderProtoView.type === api_1.ViewType.HOST) { + typeString = 'host'; + } else { + typeString = 'embedded'; + } + return hostComponentMetadata.id + "_" + typeString + "_" + pvWithIndex.index; + } + function _createAppProtoView(renderProtoView, protoChangeDetector, variableBindings, allDirectives, pipes) { + var elementBinders = renderProtoView.elementBinders; + var protoPipes = new pipes_1.ProtoPipes(pipes); + var protoView = new view_1.AppProtoView(renderProtoView.type, renderProtoView.transitiveNgContentCount > 0, renderProtoView.render, protoChangeDetector, variableBindings, createVariableLocations(elementBinders), renderProtoView.textBindings.length, protoPipes); + _createElementBinders(protoView, elementBinders, allDirectives); + return protoView; + } + function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex) { + return collection_1.ListWrapper.map(nestedPvsWithIndex, function(pvWithIndex) { + return _createVariableBindings(pvWithIndex.renderProtoView); + }); + } + function _createVariableBindings(renderProtoView) { + var variableBindings = new Map(); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + variableBindings.set(varName, mappedName); + }); + return variableBindings; + } + function _collectNestedProtoViewsVariableNames(nestedPvsWithIndex) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(nestedPvsWithIndex.length); + collection_1.ListWrapper.forEach(nestedPvsWithIndex, function(pvWithIndex) { + var parentVariableNames = lang_1.isPresent(pvWithIndex.parentIndex) ? nestedPvVariableNames[pvWithIndex.parentIndex] : null; + nestedPvVariableNames[pvWithIndex.index] = _createVariableNames(parentVariableNames, pvWithIndex.renderProtoView); + }); + return nestedPvVariableNames; + } + function _createVariableNames(parentVariableNames, renderProtoView) { + var res = lang_1.isBlank(parentVariableNames) ? [] : collection_1.ListWrapper.clone(parentVariableNames); + collection_1.MapWrapper.forEach(renderProtoView.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + collection_1.ListWrapper.forEach(renderProtoView.elementBinders, function(binder) { + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + res.push(mappedName); + }); + }); + return res; + } + function createVariableLocations(elementBinders) { + var variableLocations = new Map(); + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + collection_1.MapWrapper.forEach(binder.variableBindings, function(mappedName, varName) { + variableLocations.set(mappedName, i); + }); + } + return variableLocations; + } + exports.createVariableLocations = createVariableLocations; + function _createElementBinders(protoView, elementBinders, allDirectiveBindings) { + for (var i = 0; i < elementBinders.length; i++) { + var renderElementBinder = elementBinders[i]; + var dirs = elementBinders[i].directives; + var parentPeiWithDistance = _findParentProtoElementInjectorWithDistance(i, protoView.elementBinders, elementBinders); + var directiveBindings = collection_1.ListWrapper.map(dirs, function(dir) { + return allDirectiveBindings[dir.directiveIndex]; + }); + var componentDirectiveBinding = null; + if (directiveBindings.length > 0) { + if (directiveBindings[0].metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + componentDirectiveBinding = directiveBindings[0]; + } + } + var protoElementInjector = _createProtoElementInjector(i, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings); + _createElementBinder(protoView, i, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings); + } + } + function _findParentProtoElementInjectorWithDistance(binderIndex, elementBinders, renderElementBinders) { + var distance = 0; + do { + var renderElementBinder = renderElementBinders[binderIndex]; + binderIndex = renderElementBinder.parentIndex; + if (binderIndex !== -1) { + distance += renderElementBinder.distanceToParent; + var elementBinder = elementBinders[binderIndex]; + if (lang_1.isPresent(elementBinder.protoElementInjector)) { + return new ParentProtoElementInjectorWithDistance(elementBinder.protoElementInjector, distance); + } + } + } while (binderIndex !== -1); + return new ParentProtoElementInjectorWithDistance(null, 0); + } + function _createProtoElementInjector(binderIndex, parentPeiWithDistance, renderElementBinder, componentDirectiveBinding, directiveBindings) { + var protoElementInjector = null; + var hasVariables = collection_1.MapWrapper.size(renderElementBinder.variableBindings) > 0; + if (directiveBindings.length > 0 || hasVariables || lang_1.isPresent(renderElementBinder.nestedProtoView)) { + var directiveVariableBindings = createDirectiveVariableBindings(renderElementBinder, directiveBindings); + protoElementInjector = element_injector_1.ProtoElementInjector.create(parentPeiWithDistance.protoElementInjector, binderIndex, directiveBindings, lang_1.isPresent(componentDirectiveBinding), parentPeiWithDistance.distance, directiveVariableBindings); + protoElementInjector.attributes = renderElementBinder.readAttributes; + } + return protoElementInjector; + } + function _createElementBinder(protoView, boundElementIndex, renderElementBinder, protoElementInjector, componentDirectiveBinding, directiveBindings) { + var parent = null; + if (renderElementBinder.parentIndex !== -1) { + parent = protoView.elementBinders[renderElementBinder.parentIndex]; + } + var elBinder = protoView.bindElement(parent, renderElementBinder.distanceToParent, protoElementInjector, componentDirectiveBinding); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(mappedName, varName) { + protoView.protoLocals.set(mappedName, null); + }); + return elBinder; + } + function createDirectiveVariableBindings(renderElementBinder, directiveBindings) { + var directiveVariableBindings = new Map(); + collection_1.MapWrapper.forEach(renderElementBinder.variableBindings, function(templateName, exportAs) { + var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs); + directiveVariableBindings.set(templateName, dirIndex); + }); + return directiveVariableBindings; + } + exports.createDirectiveVariableBindings = createDirectiveVariableBindings; + function _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs) { + var matchedDirectiveIndex = null; + var matchedDirective; + for (var i = 0; i < directiveBindings.length; ++i) { + var directive = directiveBindings[i]; + if (_directiveExportAs(directive) == exportAs) { + if (lang_1.isPresent(matchedDirective)) { + throw new exceptions_1.BaseException("More than one directive have exportAs = '" + exportAs + "'. Directives: [" + matchedDirective.displayName + ", " + directive.displayName + "]"); + } + matchedDirectiveIndex = i; + matchedDirective = directive; + } + } + if (lang_1.isBlank(matchedDirective) && !lang_1.StringWrapper.equals(exportAs, "$implicit")) { + throw new exceptions_1.BaseException("Cannot find directive with exportAs = '" + exportAs + "'"); + } + return matchedDirectiveIndex; + } + function _directiveExportAs(directive) { + var directiveExportAs = directive.metadata.exportAs; + if (lang_1.isBlank(directiveExportAs) && directive.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + return "$implicit"; + } else { + return directiveExportAs; + } + } + var RenderProtoViewWithIndex = (function() { + function RenderProtoViewWithIndex(renderProtoView, index, parentIndex, boundElementIndex) { + this.renderProtoView = renderProtoView; + this.index = index; + this.parentIndex = parentIndex; + this.boundElementIndex = boundElementIndex; + } + return RenderProtoViewWithIndex; + })(); + var ParentProtoElementInjectorWithDistance = (function() { + function ParentProtoElementInjectorWithDistance(protoElementInjector, distance) { + this.protoElementInjector = protoElementInjector; + this.distance = distance; + } + return ParentProtoElementInjectorWithDistance; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var UrlResolver = (function() { + function UrlResolver() {} + UrlResolver.prototype.resolve = function(baseUrl, url) { + return _resolveUrl(baseUrl, url); + }; + UrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], UrlResolver); + return UrlResolver; + })(); + exports.UrlResolver = UrlResolver; + function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { + var out = []; + if (lang_1.isPresent(opt_scheme)) { + out.push(opt_scheme + ':'); + } + if (lang_1.isPresent(opt_domain)) { + out.push('//'); + if (lang_1.isPresent(opt_userInfo)) { + out.push(opt_userInfo + '@'); + } + out.push(opt_domain); + if (lang_1.isPresent(opt_port)) { + out.push(':' + opt_port); + } + } + if (lang_1.isPresent(opt_path)) { + out.push(opt_path); + } + if (lang_1.isPresent(opt_queryData)) { + out.push('?' + opt_queryData); + } + if (lang_1.isPresent(opt_fragment)) { + out.push('#' + opt_fragment); + } + return out.join(''); + } + var _splitRe = lang_1.RegExpWrapper.create('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$'); + var _ComponentIndex; + (function(_ComponentIndex) { + _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; + _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; + _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; + _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; + _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; + _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; + _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; + })(_ComponentIndex || (_ComponentIndex = {})); + function _split(uri) { + return lang_1.RegExpWrapper.firstMatch(_splitRe, uri); + } + function _removeDotSegments(path) { + if (path == '/') + return '/'; + var leadingSlash = path[0] == '/' ? '/' : ''; + var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; + var segments = path.split('/'); + var out = []; + var up = 0; + for (var pos = 0; pos < segments.length; pos++) { + var segment = segments[pos]; + switch (segment) { + case '': + case '.': + break; + case '..': + if (out.length > 0) { + collection_1.ListWrapper.removeAt(out, out.length - 1); + } else { + up++; + } + break; + default: + out.push(segment); + } + } + if (leadingSlash == '') { + while (up-- > 0) { + collection_1.ListWrapper.insert(out, 0, '..'); + } + if (out.length === 0) + out.push('.'); + } + return leadingSlash + out.join('/') + trailingSlash; + } + function _joinAndCanonicalizePath(parts) { + var path = parts[_ComponentIndex.Path]; + path = lang_1.isBlank(path) ? '' : _removeDotSegments(path); + parts[_ComponentIndex.Path] = path; + return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); + } + function _resolveUrl(base, url) { + var parts = _split(encodeURI(url)); + var baseParts = _split(base); + if (lang_1.isPresent(parts[_ComponentIndex.Scheme])) { + return _joinAndCanonicalizePath(parts); + } else { + parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; + } + for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { + if (lang_1.isBlank(parts[i])) { + parts[i] = baseParts[i]; + } + } + if (parts[_ComponentIndex.Path][0] == '/') { + return _joinAndCanonicalizePath(parts); + } + var path = baseParts[_ComponentIndex.Path]; + if (lang_1.isBlank(path)) + path = '/'; + var index = path.lastIndexOf('/'); + path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; + parts[_ComponentIndex.Path] = path; + return _joinAndCanonicalizePath(parts); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services/app_root_url", ["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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 AppRootUrl = (function() { + function AppRootUrl(value) { + this._value = value; + } + Object.defineProperty(AppRootUrl.prototype, "value", { + get: function() { + return this._value; + }, + set: function(value) { + this._value = value; + }, + enumerable: true, + configurable: true + }); + AppRootUrl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [String])], AppRootUrl); + return AppRootUrl; + })(); + exports.AppRootUrl = AppRootUrl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/life_cycle/life_cycle", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var profile_1 = require("angular2/src/core/profile/profile"); + var LifeCycle = (function() { + function LifeCycle(changeDetector, enforceNoNewChanges) { + if (changeDetector === void 0) { + changeDetector = null; + } + if (enforceNoNewChanges === void 0) { + enforceNoNewChanges = false; + } + this._runningTick = false; + this._changeDetectors = []; + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + this._enforceNoNewChanges = enforceNoNewChanges; + } + LifeCycle.prototype.registerWith = function(zone, changeDetector) { + var _this = this; + if (changeDetector === void 0) { + changeDetector = null; + } + if (lang_1.isPresent(changeDetector)) { + this._changeDetectors.push(changeDetector); + } + zone.overrideOnTurnDone(function() { + return _this.tick(); + }); + }; + LifeCycle.prototype.tick = function() { + if (this._runningTick) { + throw new exceptions_1.BaseException("LifeCycle.tick is called recursively"); + } + var s = LifeCycle._tickScope(); + try { + this._runningTick = true; + this._changeDetectors.forEach(function(detector) { + return detector.detectChanges(); + }); + if (this._enforceNoNewChanges) { + this._changeDetectors.forEach(function(detector) { + return detector.checkNoChanges(); + }); + } + } finally { + this._runningTick = false; + profile_1.wtfLeave(s); + } + }; + LifeCycle._tickScope = profile_1.wtfCreateScope('LifeCycle#tick()'); + LifeCycle = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [Object, Boolean])], LifeCycle); + return LifeCycle; + })(); + exports.LifeCycle = LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_url_resolver", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/services/url_resolver"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var StyleUrlResolver = (function() { + function StyleUrlResolver(_resolver) { + this._resolver = _resolver; + } + StyleUrlResolver.prototype.resolveUrls = function(cssText, baseUrl) { + cssText = this._replaceUrls(cssText, _cssUrlRe, baseUrl); + cssText = this._replaceUrls(cssText, _cssImportRe, baseUrl); + return cssText; + }; + StyleUrlResolver.prototype._replaceUrls = function(cssText, re, baseUrl) { + var _this = this; + return lang_1.StringWrapper.replaceAllMapped(cssText, re, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = _this._resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + }; + StyleUrlResolver = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [url_resolver_1.UrlResolver])], StyleUrlResolver); + return StyleUrlResolver; + })(); + exports.StyleUrlResolver = StyleUrlResolver; + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /(@import[\s]+(?!url\())['"]([^'"]*)['"](.*;)/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/template_commands", ["angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var CompiledTemplate = (function() { + function CompiledTemplate(id, dataGetter) { + this.id = id; + this.dataGetter = dataGetter; + } + CompiledTemplate = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Number, Function])], CompiledTemplate); + return CompiledTemplate; + })(); + exports.CompiledTemplate = CompiledTemplate; + var EMPTY_ARR = lang_1.CONST_EXPR([]); + var TextCmd = (function() { + function TextCmd(value, isBound, ngContentIndex) { + this.value = value; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + TextCmd.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextCmd; + })(); + exports.TextCmd = TextCmd; + function text(value, isBound, ngContentIndex) { + return new TextCmd(value, isBound, ngContentIndex); + } + exports.text = text; + var NgContentCmd = (function() { + function NgContentCmd(ngContentIndex) { + this.ngContentIndex = ngContentIndex; + this.isBound = false; + } + NgContentCmd.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentCmd; + })(); + exports.NgContentCmd = NgContentCmd; + function ngContent(ngContentIndex) { + return new NgContentCmd(ngContentIndex); + } + exports.ngContent = ngContent; + var BeginElementCmd = (function() { + function BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isBound = isBound; + this.ngContentIndex = ngContentIndex; + } + BeginElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginElement(this, context); + }; + return BeginElementCmd; + })(); + exports.BeginElementCmd = BeginElementCmd; + function beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return new BeginElementCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex); + } + exports.beginElement = beginElement; + var EndElementCmd = (function() { + function EndElementCmd() {} + EndElementCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndElement(context); + }; + return EndElementCmd; + })(); + exports.EndElementCmd = EndElementCmd; + function endElement() { + return new EndElementCmd(); + } + exports.endElement = endElement; + var BeginComponentCmd = (function() { + function BeginComponentCmd(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + this.name = name; + this.attrNameAndValues = attrNameAndValues; + this.eventTargetAndNames = eventTargetAndNames; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.nativeShadow = nativeShadow; + this.ngContentIndex = ngContentIndex; + this.template = template; + this.isBound = true; + this.component = directives[0]; + this.templateId = template.id; + } + BeginComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitBeginComponent(this, context); + }; + return BeginComponentCmd; + })(); + exports.BeginComponentCmd = BeginComponentCmd; + function beginComponent(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template) { + return new BeginComponentCmd(name, attrNameAnsValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex, template); + } + exports.beginComponent = beginComponent; + var EndComponentCmd = (function() { + function EndComponentCmd() {} + EndComponentCmd.prototype.visit = function(visitor, context) { + return visitor.visitEndComponent(context); + }; + return EndComponentCmd; + })(); + exports.EndComponentCmd = EndComponentCmd; + function endComponent() { + return new EndComponentCmd(); + } + exports.endComponent = endComponent; + var EmbeddedTemplateCmd = (function() { + function EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + this.attrNameAndValues = attrNameAndValues; + this.variableNameAndValues = variableNameAndValues; + this.directives = directives; + this.isMerged = isMerged; + this.ngContentIndex = ngContentIndex; + this.changeDetectorFactory = changeDetectorFactory; + this.children = children; + this.isBound = true; + this.name = null; + this.eventTargetAndNames = EMPTY_ARR; + } + EmbeddedTemplateCmd.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateCmd; + })(); + exports.EmbeddedTemplateCmd = EmbeddedTemplateCmd; + function embeddedTemplate(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children) { + return new EmbeddedTemplateCmd(attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, changeDetectorFactory, children); + } + exports.embeddedTemplate = embeddedTemplate; + function visitAllCommands(visitor, cmds, context) { + if (context === void 0) { + context = null; + } + for (var i = 0; i < cmds.length; i++) { + cmds[i].visit(visitor, context); + } + } + exports.visitAllCommands = visitAllCommands; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/selector", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var _EMPTY_ATTR_VALUE = ''; + var _SELECTOR_REGEXP = lang_1.RegExpWrapper.create('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + '(?:\\[([-\\w*]+)(?:=([^\\]]*))?\\])|' + '(\\))|' + '(\\s*,\\s*)'); + var CssSelector = (function() { + function CssSelector() { + this.element = null; + this.classNames = []; + this.attrs = []; + this.notSelectors = []; + } + CssSelector.parse = function(selector) { + var results = []; + var _addResult = function(res, cssSel) { + if (cssSel.notSelectors.length > 0 && lang_1.isBlank(cssSel.element) && collection_1.ListWrapper.isEmpty(cssSel.classNames) && collection_1.ListWrapper.isEmpty(cssSel.attrs)) { + cssSel.element = "*"; + } + res.push(cssSel); + }; + var cssSelector = new CssSelector(); + var matcher = lang_1.RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); + var match; + var current = cssSelector; + var inNot = false; + while (lang_1.isPresent(match = lang_1.RegExpMatcherWrapper.next(matcher))) { + if (lang_1.isPresent(match[1])) { + if (inNot) { + throw new exceptions_1.BaseException('Nesting :not is not allowed in a selector'); + } + inNot = true; + current = new CssSelector(); + cssSelector.notSelectors.push(current); + } + if (lang_1.isPresent(match[2])) { + current.setElement(match[2]); + } + if (lang_1.isPresent(match[3])) { + current.addClassName(match[3]); + } + if (lang_1.isPresent(match[4])) { + current.addAttribute(match[4], match[5]); + } + if (lang_1.isPresent(match[6])) { + inNot = false; + current = cssSelector; + } + if (lang_1.isPresent(match[7])) { + if (inNot) { + throw new exceptions_1.BaseException('Multiple selectors in :not are not supported'); + } + _addResult(results, cssSelector); + cssSelector = current = new CssSelector(); + } + } + _addResult(results, cssSelector); + return results; + }; + CssSelector.prototype.isElementSelector = function() { + return lang_1.isPresent(this.element) && collection_1.ListWrapper.isEmpty(this.classNames) && collection_1.ListWrapper.isEmpty(this.attrs) && this.notSelectors.length === 0; + }; + CssSelector.prototype.setElement = function(element) { + if (element === void 0) { + element = null; + } + if (lang_1.isPresent(element)) { + element = element.toLowerCase(); + } + this.element = element; + }; + CssSelector.prototype.getMatchingElementTemplate = function() { + var tagName = lang_1.isPresent(this.element) ? this.element : 'div'; + var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; + var attrs = ''; + for (var i = 0; i < this.attrs.length; i += 2) { + var attrName = this.attrs[i]; + var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; + attrs += " " + attrName + attrValue; + } + return "<" + tagName + classAttr + attrs + ">"; + }; + CssSelector.prototype.addAttribute = function(name, value) { + if (value === void 0) { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(name.toLowerCase()); + if (lang_1.isPresent(value)) { + value = value.toLowerCase(); + } else { + value = _EMPTY_ATTR_VALUE; + } + this.attrs.push(value); + }; + CssSelector.prototype.addClassName = function(name) { + this.classNames.push(name.toLowerCase()); + }; + CssSelector.prototype.toString = function() { + var res = ''; + if (lang_1.isPresent(this.element)) { + res += this.element; + } + if (lang_1.isPresent(this.classNames)) { + for (var i = 0; i < this.classNames.length; i++) { + res += '.' + this.classNames[i]; + } + } + if (lang_1.isPresent(this.attrs)) { + for (var i = 0; i < this.attrs.length; ) { + var attrName = this.attrs[i++]; + var attrValue = this.attrs[i++]; + res += '[' + attrName; + if (attrValue.length > 0) { + res += '=' + attrValue; + } + res += ']'; + } + } + collection_1.ListWrapper.forEach(this.notSelectors, function(notSelector) { + res += ":not(" + notSelector.toString() + ")"; + }); + return res; + }; + return CssSelector; + })(); + exports.CssSelector = CssSelector; + var SelectorMatcher = (function() { + function SelectorMatcher() { + this._elementMap = new collection_1.Map(); + this._elementPartialMap = new collection_1.Map(); + this._classMap = new collection_1.Map(); + this._classPartialMap = new collection_1.Map(); + this._attrValueMap = new collection_1.Map(); + this._attrValuePartialMap = new collection_1.Map(); + this._listContexts = []; + } + SelectorMatcher.createNotMatcher = function(notSelectors) { + var notMatcher = new SelectorMatcher(); + notMatcher.addSelectables(notSelectors, null); + return notMatcher; + }; + SelectorMatcher.prototype.addSelectables = function(cssSelectors, callbackCtxt) { + var listContext = null; + if (cssSelectors.length > 1) { + listContext = new SelectorListContext(cssSelectors); + this._listContexts.push(listContext); + } + for (var i = 0; i < cssSelectors.length; i++) { + this._addSelectable(cssSelectors[i], callbackCtxt, listContext); + } + }; + SelectorMatcher.prototype._addSelectable = function(cssSelector, callbackCtxt, listContext) { + var matcher = this; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); + if (lang_1.isPresent(element)) { + var isTerminal = attrs.length === 0 && classNames.length === 0; + if (isTerminal) { + this._addTerminal(matcher._elementMap, element, selectable); + } else { + matcher = this._addPartial(matcher._elementPartialMap, element); + } + } + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var isTerminal = attrs.length === 0 && index === classNames.length - 1; + var className = classNames[index]; + if (isTerminal) { + this._addTerminal(matcher._classMap, className, selectable); + } else { + matcher = this._addPartial(matcher._classPartialMap, className); + } + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var isTerminal = index === attrs.length - 2; + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + if (isTerminal) { + var terminalMap = matcher._attrValueMap; + var terminalValuesMap = terminalMap.get(attrName); + if (lang_1.isBlank(terminalValuesMap)) { + terminalValuesMap = new collection_1.Map(); + terminalMap.set(attrName, terminalValuesMap); + } + this._addTerminal(terminalValuesMap, attrValue, selectable); + } else { + var parttialMap = matcher._attrValuePartialMap; + var partialValuesMap = parttialMap.get(attrName); + if (lang_1.isBlank(partialValuesMap)) { + partialValuesMap = new collection_1.Map(); + parttialMap.set(attrName, partialValuesMap); + } + matcher = this._addPartial(partialValuesMap, attrValue); + } + } + } + }; + SelectorMatcher.prototype._addTerminal = function(map, name, selectable) { + var terminalList = map.get(name); + if (lang_1.isBlank(terminalList)) { + terminalList = []; + map.set(name, terminalList); + } + terminalList.push(selectable); + }; + SelectorMatcher.prototype._addPartial = function(map, name) { + var matcher = map.get(name); + if (lang_1.isBlank(matcher)) { + matcher = new SelectorMatcher(); + map.set(name, matcher); + } + return matcher; + }; + SelectorMatcher.prototype.match = function(cssSelector, matchedCallback) { + var result = false; + var element = cssSelector.element; + var classNames = cssSelector.classNames; + var attrs = cssSelector.attrs; + for (var i = 0; i < this._listContexts.length; i++) { + this._listContexts[i].alreadyMatched = false; + } + result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; + if (lang_1.isPresent(classNames)) { + for (var index = 0; index < classNames.length; index++) { + var className = classNames[index]; + result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; + result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; + } + } + if (lang_1.isPresent(attrs)) { + for (var index = 0; index < attrs.length; ) { + var attrName = attrs[index++]; + var attrValue = attrs[index++]; + var terminalValuesMap = this._attrValueMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchTerminal(terminalValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchTerminal(terminalValuesMap, attrValue, cssSelector, matchedCallback) || result; + var partialValuesMap = this._attrValuePartialMap.get(attrName); + if (!lang_1.StringWrapper.equals(attrValue, _EMPTY_ATTR_VALUE)) { + result = this._matchPartial(partialValuesMap, _EMPTY_ATTR_VALUE, cssSelector, matchedCallback) || result; + } + result = this._matchPartial(partialValuesMap, attrValue, cssSelector, matchedCallback) || result; + } + } + return result; + }; + SelectorMatcher.prototype._matchTerminal = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var selectables = map.get(name); + var starSelectables = map.get("*"); + if (lang_1.isPresent(starSelectables)) { + selectables = selectables.concat(starSelectables); + } + if (lang_1.isBlank(selectables)) { + return false; + } + var selectable; + var result = false; + for (var index = 0; index < selectables.length; index++) { + selectable = selectables[index]; + result = selectable.finalize(cssSelector, matchedCallback) || result; + } + return result; + }; + SelectorMatcher.prototype._matchPartial = function(map, name, cssSelector, matchedCallback) { + if (lang_1.isBlank(map) || lang_1.isBlank(name)) { + return false; + } + var nestedSelector = map.get(name); + if (lang_1.isBlank(nestedSelector)) { + return false; + } + return nestedSelector.match(cssSelector, matchedCallback); + }; + return SelectorMatcher; + })(); + exports.SelectorMatcher = SelectorMatcher; + var SelectorListContext = (function() { + function SelectorListContext(selectors) { + this.selectors = selectors; + this.alreadyMatched = false; + } + return SelectorListContext; + })(); + exports.SelectorListContext = SelectorListContext; + var SelectorContext = (function() { + function SelectorContext(selector, cbContext, listContext) { + this.selector = selector; + this.cbContext = cbContext; + this.listContext = listContext; + this.notSelectors = selector.notSelectors; + } + SelectorContext.prototype.finalize = function(cssSelector, callback) { + var result = true; + if (this.notSelectors.length > 0 && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); + result = !notMatcher.match(cssSelector, null); + } + if (result && lang_1.isPresent(callback) && (lang_1.isBlank(this.listContext) || !this.listContext.alreadyMatched)) { + if (lang_1.isPresent(this.listContext)) { + this.listContext.alreadyMatched = true; + } + callback(this.selector, this.cbContext); + } + return result; + }; + return SelectorContext; + })(); + exports.SelectorContext = SelectorContext; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/util", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CAMEL_CASE_REGEXP = /([A-Z])/g; + var DASH_CASE_REGEXP = /-([a-z])/g; + var SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\$/g; + var DOUBLE_QUOTE_ESCAPE_STRING_RE = /"|\\|\n|\$/g; + exports.IS_DART = !lang_1.isJsObject({}); + 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; + function escapeSingleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "'" + escapeString(input, SINGLE_QUOTE_ESCAPE_STRING_RE) + "'"; + } + exports.escapeSingleQuoteString = escapeSingleQuoteString; + function escapeDoubleQuoteString(input) { + if (lang_1.isBlank(input)) { + return null; + } + return "\"" + escapeString(input, DOUBLE_QUOTE_ESCAPE_STRING_RE) + "\""; + } + exports.escapeDoubleQuoteString = escapeDoubleQuoteString; + function escapeString(input, re) { + return lang_1.StringWrapper.replaceAllMapped(input, re, function(match) { + if (match[0] == '$') { + return exports.IS_DART ? '\\$' : '$'; + } else if (match[0] == '\n') { + return '\\n'; + } else { + return "\\" + match[0]; + } + }); + } + function codeGenExportVariable(name) { + return exports.IS_DART ? "var " + name + " = " : "var " + name + " = exports['" + name + "'] = "; + } + exports.codeGenExportVariable = codeGenExportVariable; + function codeGenConcatArray(expression) { + return (exports.IS_DART ? '..addAll' : '.concat') + "(" + expression + ")"; + } + exports.codeGenConcatArray = codeGenConcatArray; + function codeGenMapArray(argNames, callback) { + if (exports.IS_DART) { + return ".map( (" + argNames.join(',') + ") => " + callback + " ).toList()"; + } else { + return ".map(function(" + argNames.join(',') + ") { return " + callback + "; })"; + } + } + exports.codeGenMapArray = codeGenMapArray; + function codeGenReplaceAll(pattern, value) { + if (exports.IS_DART) { + return ".replaceAll('" + pattern + "', '" + value + "')"; + } else { + return ".replace(/" + pattern + "/g, '" + value + "')"; + } + } + exports.codeGenReplaceAll = codeGenReplaceAll; + function codeGenValueFn(params, value) { + if (exports.IS_DART) { + return "(" + params.join(',') + ") => " + value; + } else { + return "function(" + params.join(',') + ") { return " + value + "; }"; + } + } + exports.codeGenValueFn = codeGenValueFn; + function splitAtColon(input, defaultValues) { + var parts = lang_1.StringWrapper.split(input.trim(), /\s*:\s*/g); + if (parts.length > 1) { + return parts; + } else { + return defaultValues; + } + } + exports.splitAtColon = splitAtColon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/source_module", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var MODULE_REGEXP = /#MODULE\[([^\]]*)\]/g; + function moduleRef(moduleId) { + return "#MODULE[" + moduleId + "]"; + } + exports.moduleRef = moduleRef; + var SourceModule = (function() { + function SourceModule(moduleId, sourceWithModuleRefs) { + this.moduleId = moduleId; + this.sourceWithModuleRefs = sourceWithModuleRefs; + } + SourceModule.prototype.getSourceWithImports = function() { + var _this = this; + var moduleAliases = {}; + var imports = []; + var newSource = lang_1.StringWrapper.replaceAllMapped(this.sourceWithModuleRefs, MODULE_REGEXP, function(match) { + var moduleId = match[1]; + var alias = moduleAliases[moduleId]; + if (lang_1.isBlank(alias)) { + if (moduleId == _this.moduleId) { + alias = ''; + } else { + alias = "import" + imports.length; + imports.push([moduleId, alias]); + } + moduleAliases[moduleId] = alias; + } + return alias.length > 0 ? alias + "." : ''; + }); + return new SourceWithImports(newSource, imports); + }; + return SourceModule; + })(); + exports.SourceModule = SourceModule; + var SourceExpression = (function() { + function SourceExpression(declarations, expression) { + this.declarations = declarations; + this.expression = expression; + } + return SourceExpression; + })(); + exports.SourceExpression = SourceExpression; + var SourceExpressions = (function() { + function SourceExpressions(declarations, expressions) { + this.declarations = declarations; + this.expressions = expressions; + } + return SourceExpressions; + })(); + exports.SourceExpressions = SourceExpressions; + var SourceWithImports = (function() { + function SourceWithImports(source, imports) { + this.source = source; + this.imports = imports; + } + return SourceWithImports; + })(); + exports.SourceWithImports = SourceWithImports; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var TextAst = (function() { + function TextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + TextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return TextAst; + })(); + exports.TextAst = TextAst; + var BoundTextAst = (function() { + function BoundTextAst(value, ngContentIndex, sourceInfo) { + this.value = value; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + BoundTextAst.prototype.visit = function(visitor, context) { + return visitor.visitBoundText(this, context); + }; + return BoundTextAst; + })(); + exports.BoundTextAst = BoundTextAst; + var AttrAst = (function() { + function AttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + AttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return AttrAst; + })(); + exports.AttrAst = AttrAst; + var BoundElementPropertyAst = (function() { + function BoundElementPropertyAst(name, type, value, unit, sourceInfo) { + this.name = name; + this.type = type; + this.value = value; + this.unit = unit; + this.sourceInfo = sourceInfo; + } + BoundElementPropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitElementProperty(this, context); + }; + return BoundElementPropertyAst; + })(); + exports.BoundElementPropertyAst = BoundElementPropertyAst; + var BoundEventAst = (function() { + function BoundEventAst(name, target, handler, sourceInfo) { + this.name = name; + this.target = target; + this.handler = handler; + this.sourceInfo = sourceInfo; + } + BoundEventAst.prototype.visit = function(visitor, context) { + return visitor.visitEvent(this, context); + }; + Object.defineProperty(BoundEventAst.prototype, "fullName", { + get: function() { + if (lang_1.isPresent(this.target)) { + return this.target + ":" + this.name; + } else { + return this.name; + } + }, + enumerable: true, + configurable: true + }); + return BoundEventAst; + })(); + exports.BoundEventAst = BoundEventAst; + var VariableAst = (function() { + function VariableAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + VariableAst.prototype.visit = function(visitor, context) { + return visitor.visitVariable(this, context); + }; + return VariableAst; + })(); + exports.VariableAst = VariableAst; + var ElementAst = (function() { + function ElementAst(name, attrs, properties, events, exportAsVars, directives, children, ngContentIndex, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.properties = properties; + this.events = events; + this.exportAsVars = exportAsVars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + ElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + ElementAst.prototype.isBound = function() { + return (this.properties.length > 0 || this.events.length > 0 || this.exportAsVars.length > 0 || this.directives.length > 0); + }; + ElementAst.prototype.getComponent = function() { + return this.directives.length > 0 && this.directives[0].directive.isComponent ? this.directives[0].directive : null; + }; + return ElementAst; + })(); + exports.ElementAst = ElementAst; + var EmbeddedTemplateAst = (function() { + function EmbeddedTemplateAst(attrs, vars, directives, children, ngContentIndex, sourceInfo) { + this.attrs = attrs; + this.vars = vars; + this.directives = directives; + this.children = children; + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + EmbeddedTemplateAst.prototype.visit = function(visitor, context) { + return visitor.visitEmbeddedTemplate(this, context); + }; + return EmbeddedTemplateAst; + })(); + exports.EmbeddedTemplateAst = EmbeddedTemplateAst; + var BoundDirectivePropertyAst = (function() { + function BoundDirectivePropertyAst(directiveName, templateName, value, sourceInfo) { + this.directiveName = directiveName; + this.templateName = templateName; + this.value = value; + this.sourceInfo = sourceInfo; + } + BoundDirectivePropertyAst.prototype.visit = function(visitor, context) { + return visitor.visitDirectiveProperty(this, context); + }; + return BoundDirectivePropertyAst; + })(); + exports.BoundDirectivePropertyAst = BoundDirectivePropertyAst; + var DirectiveAst = (function() { + function DirectiveAst(directive, properties, hostProperties, hostEvents, exportAsVars, sourceInfo) { + this.directive = directive; + this.properties = properties; + this.hostProperties = hostProperties; + this.hostEvents = hostEvents; + this.exportAsVars = exportAsVars; + this.sourceInfo = sourceInfo; + } + DirectiveAst.prototype.visit = function(visitor, context) { + return visitor.visitDirective(this, context); + }; + return DirectiveAst; + })(); + exports.DirectiveAst = DirectiveAst; + var NgContentAst = (function() { + function NgContentAst(ngContentIndex, sourceInfo) { + this.ngContentIndex = ngContentIndex; + this.sourceInfo = sourceInfo; + } + NgContentAst.prototype.visit = function(visitor, context) { + return visitor.visitNgContent(this, context); + }; + return NgContentAst; + })(); + exports.NgContentAst = NgContentAst; + (function(PropertyBindingType) { + PropertyBindingType[PropertyBindingType["Property"] = 0] = "Property"; + PropertyBindingType[PropertyBindingType["Attribute"] = 1] = "Attribute"; + PropertyBindingType[PropertyBindingType["Class"] = 2] = "Class"; + PropertyBindingType[PropertyBindingType["Style"] = 3] = "Style"; + })(exports.PropertyBindingType || (exports.PropertyBindingType = {})); + var PropertyBindingType = exports.PropertyBindingType; + function templateVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.templateVisitAll = templateVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/transform/template_compiler/change_detector_codegen", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var Codegen = (function() { + function Codegen(moduleAlias) {} + Codegen.prototype.generate = function(typeName, changeDetectorTypeName, def) { + throw "Not implemented in JS"; + }; + Codegen.prototype.toString = function() { + throw "Not implemented in JS"; + }; + return Codegen; + })(); + exports.Codegen = Codegen; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/xhr", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var XHR = (function() { + function XHR() {} + XHR.prototype.get = function(url) { + return null; + }; + return XHR; + })(); + exports.XHR = XHR; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/shadow_css", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ShadowCss = (function() { + function ShadowCss() { + this.strictStyling = true; + } + ShadowCss.prototype.shimStyle = function(style, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + var cssText = dom_adapter_1.DOM.getText(style); + return this.shimCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype.shimCssText = function(cssText, selector, hostSelector) { + if (hostSelector === void 0) { + hostSelector = ''; + } + cssText = this._insertDirectives(cssText); + return this._scopeCssText(cssText, selector, hostSelector); + }; + ShadowCss.prototype._insertDirectives = function(cssText) { + cssText = this._insertPolyfillDirectivesInCssText(cssText); + return this._insertPolyfillRulesInCssText(cssText); + }; + ShadowCss.prototype._insertPolyfillDirectivesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentNextSelectorRe, function(m) { + return m[1] + '{'; + }); + }; + ShadowCss.prototype._insertPolyfillRulesInCssText = function(cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssContentRuleRe, function(m) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[1], ''); + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + return m[3] + rule; + }); + }; + ShadowCss.prototype._scopeCssText = function(cssText, scopeSelector, hostSelector) { + var _this = this; + var unscoped = this._extractUnscopedRulesFromCssText(cssText); + cssText = this._insertPolyfillHostInCssText(cssText); + cssText = this._convertColonHost(cssText); + cssText = this._convertColonHostContext(cssText); + cssText = this._convertShadowDOMSelectors(cssText); + if (lang_1.isPresent(scopeSelector)) { + _withCssRules(cssText, function(rules) { + cssText = _this._scopeRules(rules, scopeSelector, hostSelector); + }); + } + cssText = cssText + '\n' + unscoped; + return cssText.trim(); + }; + ShadowCss.prototype._extractUnscopedRulesFromCssText = function(cssText) { + var r = '', + m; + var matcher = lang_1.RegExpWrapper.matcher(_cssContentUnscopedRuleRe, cssText); + while (lang_1.isPresent(m = lang_1.RegExpMatcherWrapper.next(matcher))) { + var rule = m[0]; + rule = lang_1.StringWrapper.replace(rule, m[2], ''); + rule = lang_1.StringWrapper.replace(rule, m[1], m[3]); + r += rule + '\n\n'; + } + return r; + }; + ShadowCss.prototype._convertColonHost = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); + }; + ShadowCss.prototype._convertColonHostContext = function(cssText) { + return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); + }; + ShadowCss.prototype._convertColonRule = function(cssText, regExp, partReplacer) { + return lang_1.StringWrapper.replaceAllMapped(cssText, regExp, function(m) { + if (lang_1.isPresent(m[2])) { + var parts = m[2].split(','), + r = []; + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + if (lang_1.isBlank(p)) + break; + p = p.trim(); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); + } + return r.join(','); + } else { + return _polyfillHostNoCombinator + m[3]; + } + }); + }; + ShadowCss.prototype._colonHostContextPartReplacer = function(host, part, suffix) { + if (lang_1.StringWrapper.contains(part, _polyfillHost)) { + return this._colonHostPartReplacer(host, part, suffix); + } else { + return host + part + suffix + ', ' + part + ' ' + host + suffix; + } + }; + ShadowCss.prototype._colonHostPartReplacer = function(host, part, suffix) { + return host + lang_1.StringWrapper.replace(part, _polyfillHost, '') + suffix; + }; + ShadowCss.prototype._convertShadowDOMSelectors = function(cssText) { + for (var i = 0; i < _shadowDOMSelectorsRe.length; i++) { + cssText = lang_1.StringWrapper.replaceAll(cssText, _shadowDOMSelectorsRe[i], ' '); + } + return cssText; + }; + ShadowCss.prototype._scopeRules = function(cssRules, scopeSelector, hostSelector) { + var cssText = ''; + if (lang_1.isPresent(cssRules)) { + for (var i = 0; i < cssRules.length; i++) { + var rule = cssRules[i]; + if (dom_adapter_1.DOM.isStyleRule(rule) || dom_adapter_1.DOM.isPageRule(rule)) { + cssText += this._scopeSelector(rule.selectorText, scopeSelector, hostSelector, this.strictStyling) + ' {\n'; + cssText += this._propertiesFromRule(rule) + '\n}\n\n'; + } else if (dom_adapter_1.DOM.isMediaRule(rule)) { + cssText += '@media ' + rule.media.mediaText + ' {\n'; + cssText += this._scopeRules(rule.cssRules, scopeSelector, hostSelector); + cssText += '\n}\n\n'; + } else { + try { + if (lang_1.isPresent(rule.cssText)) { + cssText += rule.cssText + '\n\n'; + } + } catch (x) { + if (dom_adapter_1.DOM.isKeyframesRule(rule) && lang_1.isPresent(rule.cssRules)) { + cssText += this._ieSafeCssTextFromKeyFrameRule(rule); + } + } + } + } + } + return cssText; + }; + ShadowCss.prototype._ieSafeCssTextFromKeyFrameRule = function(rule) { + var cssText = '@keyframes ' + rule.name + ' {'; + for (var i = 0; i < rule.cssRules.length; i++) { + var r = rule.cssRules[i]; + cssText += ' ' + r.keyText + ' {' + r.style.cssText + '}'; + } + cssText += ' }'; + return cssText; + }; + ShadowCss.prototype._scopeSelector = function(selector, scopeSelector, hostSelector, strict) { + var r = [], + parts = selector.split(','); + for (var i = 0; i < parts.length; i++) { + var p = parts[i]; + p = p.trim(); + if (this._selectorNeedsScoping(p, scopeSelector)) { + p = strict && !lang_1.StringWrapper.contains(p, _polyfillHostNoCombinator) ? this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); + } + r.push(p); + } + return r.join(', '); + }; + ShadowCss.prototype._selectorNeedsScoping = function(selector, scopeSelector) { + var re = this._makeScopeMatcher(scopeSelector); + return !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(re, selector)); + }; + ShadowCss.prototype._makeScopeMatcher = function(scopeSelector) { + var lre = /\[/g; + var rre = /\]/g; + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, lre, '\\['); + scopeSelector = lang_1.StringWrapper.replaceAll(scopeSelector, rre, '\\]'); + return lang_1.RegExpWrapper.create('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); + }; + ShadowCss.prototype._applySelectorScope = function(selector, scopeSelector, hostSelector) { + return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); + }; + ShadowCss.prototype._applySimpleSelectorScope = function(selector, scopeSelector, hostSelector) { + if (lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(_polyfillHostRe, selector))) { + var replaceBy = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector; + selector = lang_1.StringWrapper.replace(selector, _polyfillHostNoCombinator, replaceBy); + return lang_1.StringWrapper.replaceAll(selector, _polyfillHostRe, replaceBy + ' '); + } else { + return scopeSelector + ' ' + selector; + } + }; + ShadowCss.prototype._applyStrictSelectorScope = function(selector, scopeSelector) { + var isRe = /\[is=([^\]]*)\]/g; + scopeSelector = lang_1.StringWrapper.replaceAllMapped(scopeSelector, isRe, function(m) { + return m[1]; + }); + var splits = [' ', '>', '+', '~'], + scoped = selector, + attrName = '[' + scopeSelector + ']'; + for (var i = 0; i < splits.length; i++) { + var sep = splits[i]; + var parts = scoped.split(sep); + scoped = collection_1.ListWrapper.map(parts, function(p) { + var t = lang_1.StringWrapper.replaceAll(p.trim(), _polyfillHostRe, ''); + if (t.length > 0 && !collection_1.ListWrapper.contains(splits, t) && !lang_1.StringWrapper.contains(t, attrName)) { + var re = /([^:]*)(:*)(.*)/g; + var m = lang_1.RegExpWrapper.firstMatch(re, t); + if (lang_1.isPresent(m)) { + p = m[1] + attrName + m[2] + m[3]; + } + } + return p; + }).join(sep); + } + return scoped; + }; + ShadowCss.prototype._insertPolyfillHostInCssText = function(selector) { + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostContextRe, _polyfillHostContext); + selector = lang_1.StringWrapper.replaceAll(selector, _colonHostRe, _polyfillHost); + return selector; + }; + ShadowCss.prototype._propertiesFromRule = function(rule) { + var cssText = rule.style.cssText; + var attrRe = /['"]+|attr/g; + if (rule.style.content.length > 0 && !lang_1.isPresent(lang_1.RegExpWrapper.firstMatch(attrRe, rule.style.content))) { + var contentRe = /content:[^;]*;/g; + cssText = lang_1.StringWrapper.replaceAll(cssText, contentRe, 'content: \'' + rule.style.content + '\';'); + } + return cssText; + }; + return ShadowCss; + })(); + exports.ShadowCss = ShadowCss; + var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim; + var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim; + var _polyfillHost = '-shadowcsshost'; + var _polyfillHostContext = '-shadowcsscontext'; + var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; + var _cssColonHostRe = lang_1.RegExpWrapper.create('(' + _polyfillHost + _parenSuffix, 'im'); + var _cssColonHostContextRe = lang_1.RegExpWrapper.create('(' + _polyfillHostContext + _parenSuffix, 'im'); + var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; + var _shadowDOMSelectorsRe = [/>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow-deep\//g, /\/shadow\//g]; + var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; + var _polyfillHostRe = lang_1.RegExpWrapper.create(_polyfillHost, 'im'); + var _colonHostRe = /:host/gim; + var _colonHostContextRe = /:host-context/gim; + function _cssToRules(cssText) { + return dom_adapter_1.DOM.cssToRules(cssText); + } + function _withCssRules(cssText, callback) { + if (lang_1.isBlank(callback)) + return ; + var rules = _cssToRules(cssText); + callback(rules); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_url_resolver", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + function resolveStyleUrls(resolver, baseUrl, cssText) { + var foundUrls = []; + cssText = extractUrls(resolver, baseUrl, cssText, foundUrls); + cssText = replaceUrls(resolver, baseUrl, cssText); + return new StyleWithImports(cssText, foundUrls); + } + exports.resolveStyleUrls = resolveStyleUrls; + var StyleWithImports = (function() { + function StyleWithImports(style, styleUrls) { + this.style = style; + this.styleUrls = styleUrls; + } + return StyleWithImports; + })(); + exports.StyleWithImports = StyleWithImports; + function extractUrls(resolver, baseUrl, cssText, foundUrls) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssImportRe, function(m) { + var url = lang_1.isPresent(m[1]) ? m[1] : m[2]; + foundUrls.push(resolver.resolve(baseUrl, url)); + return ''; + }); + } + function replaceUrls(resolver, baseUrl, cssText) { + return lang_1.StringWrapper.replaceAllMapped(cssText, _cssUrlRe, function(m) { + var pre = m[1]; + var originalUrl = m[2]; + if (lang_1.RegExpWrapper.test(_dataUrlRe, originalUrl)) { + return m[0]; + } + var url = lang_1.StringWrapper.replaceAll(originalUrl, _quoteRe, ''); + var post = m[3]; + var resolvedUrl = resolver.resolve(baseUrl, url); + return pre + "'" + resolvedUrl + "'" + post; + }); + } + var _cssUrlRe = /(url\()([^)]*)(\))/g; + var _cssImportRe = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; + var _quoteRe = /['"]/g; + var _dataUrlRe = /^['"]?data:/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/command_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/template_ast", "angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/compiler/style_compiler", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + exports.TEMPLATE_COMMANDS_MODULE_REF = source_module_1.moduleRef('angular2/src/core/compiler/template_commands'); + var IMPLICIT_TEMPLATE_VAR = '\$implicit'; + var CommandCompiler = (function() { + function CommandCompiler() {} + CommandCompiler.prototype.compileComponentRuntime = function(component, template, changeDetectorFactories, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories), component, 0); + template_ast_1.templateVisitAll(visitor, template); + return visitor.result; + }; + CommandCompiler.prototype.compileComponentCodeGen = function(component, template, changeDetectorFactoryExpressions, componentTemplateFactory) { + var visitor = new CommandBuilderVisitor(new CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions), component, 0); + template_ast_1.templateVisitAll(visitor, template); + var source = "[" + visitor.result.join(',') + "]"; + return new source_module_1.SourceExpression([], source); + }; + CommandCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CommandCompiler); + return CommandCompiler; + })(); + exports.CommandCompiler = CommandCompiler; + var RuntimeCommandFactory = (function() { + function RuntimeCommandFactory(componentTemplateFactory, changeDetectorFactories) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactories = changeDetectorFactories; + } + RuntimeCommandFactory.prototype._mapDirectives = function(directives) { + return directives.map(function(directive) { + return directive.type.runtime; + }); + }; + RuntimeCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return template_commands_1.text(value, isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return template_commands_1.ngContent(ngContentIndex); + }; + RuntimeCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return template_commands_1.beginElement(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), isBound, ngContentIndex); + }; + RuntimeCommandFactory.prototype.createEndElement = function() { + return template_commands_1.endElement(); + }; + RuntimeCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return template_commands_1.beginComponent(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, this._mapDirectives(directives), nativeShadow, ngContentIndex, this.componentTemplateFactory(directives[0])); + }; + RuntimeCommandFactory.prototype.createEndComponent = function() { + return template_commands_1.endComponent(); + }; + RuntimeCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return template_commands_1.embeddedTemplate(attrNameAndValues, variableNameAndValues, this._mapDirectives(directives), isMerged, ngContentIndex, this.changeDetectorFactories[embeddedTemplateIndex], children); + }; + return RuntimeCommandFactory; + })(); + function escapePrimitiveArray(data) { + return "[" + data.map(function(value) { + if (lang_1.isString(value)) { + return util_1.escapeSingleQuoteString(value); + } else if (lang_1.isBlank(value)) { + return 'null'; + } else { + return value; + } + }).join(',') + "]"; + } + var CodegenCommandFactory = (function() { + function CodegenCommandFactory(componentTemplateFactory, changeDetectorFactoryExpressions) { + this.componentTemplateFactory = componentTemplateFactory; + this.changeDetectorFactoryExpressions = changeDetectorFactoryExpressions; + } + CodegenCommandFactory.prototype.createText = function(value, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "text(" + util_1.escapeSingleQuoteString(value) + ", " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createNgContent = function(ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "ngContent(" + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createBeginElement = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, isBound, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginElement(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + isBound + ", " + ngContentIndex + ")"; + }; + CodegenCommandFactory.prototype.createEndElement = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endElement()"; + }; + CodegenCommandFactory.prototype.createBeginComponent = function(name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, nativeShadow, ngContentIndex) { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "beginComponent(" + util_1.escapeSingleQuoteString(name) + ", " + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(eventTargetAndNames) + ", " + escapePrimitiveArray(variableNameAndValues) + ", [" + _escapeDirectives(directives).join(',') + "], " + nativeShadow + ", " + ngContentIndex + ", " + this.componentTemplateFactory(directives[0]) + ")"; + }; + CodegenCommandFactory.prototype.createEndComponent = function() { + return exports.TEMPLATE_COMMANDS_MODULE_REF + "endComponent()"; + }; + CodegenCommandFactory.prototype.createEmbeddedTemplate = function(embeddedTemplateIndex, attrNameAndValues, variableNameAndValues, directives, isMerged, ngContentIndex, children) { + return (exports.TEMPLATE_COMMANDS_MODULE_REF + "embeddedTemplate(" + escapePrimitiveArray(attrNameAndValues) + ", " + escapePrimitiveArray(variableNameAndValues) + ", ") + ("[" + _escapeDirectives(directives).join(',') + "], " + isMerged + ", " + ngContentIndex + ", " + this.changeDetectorFactoryExpressions[embeddedTemplateIndex] + ", [" + children.join(',') + "])"); + }; + return CodegenCommandFactory; + })(); + function _escapeDirectives(directives) { + return directives.map(function(directiveType) { + return ("" + source_module_1.moduleRef(directiveType.type.moduleId) + directiveType.type.name); + }); + } + function visitAndReturnContext(visitor, asts, context) { + template_ast_1.templateVisitAll(visitor, asts, context); + return context; + } + var CommandBuilderVisitor = (function() { + function CommandBuilderVisitor(commandFactory, component, embeddedTemplateIndex) { + this.commandFactory = commandFactory; + this.component = component; + this.embeddedTemplateIndex = embeddedTemplateIndex; + this.result = []; + this.transitiveNgContentCount = 0; + } + CommandBuilderVisitor.prototype._readAttrNameAndValues = function(localComponent, directives, attrAsts) { + var attrNameAndValues = visitAndReturnContext(this, attrAsts, []); + if (lang_1.isPresent(localComponent) && localComponent.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimHostAttribute(localComponent.type.id)); + attrNameAndValues.push(''); + } + if (this.component.template.encapsulation === api_1.ViewEncapsulation.Emulated) { + attrNameAndValues.push(style_compiler_1.shimContentAttribute(this.component.type.id)); + attrNameAndValues.push(''); + } + directives.forEach(function(directiveMeta) { + collection_1.StringMapWrapper.forEach(directiveMeta.hostAttributes, function(value, name) { + attrNameAndValues.push(name); + attrNameAndValues.push(value); + }); + }); + return removeKeyValueArrayDuplicates(attrNameAndValues); + }; + CommandBuilderVisitor.prototype.visitNgContent = function(ast, context) { + this.transitiveNgContentCount++; + this.result.push(this.commandFactory.createNgContent(ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + var _this = this; + this.embeddedTemplateIndex++; + var childVisitor = new CommandBuilderVisitor(this.commandFactory, this.component, this.embeddedTemplateIndex); + template_ast_1.templateVisitAll(childVisitor, ast.children); + var isMerged = childVisitor.transitiveNgContentCount > 0; + var variableNameAndValues = []; + ast.vars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(varAst.value.length > 0 ? varAst.value : IMPLICIT_TEMPLATE_VAR); + }); + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, [], [], directives)); + }); + this.result.push(this.commandFactory.createEmbeddedTemplate(this.embeddedTemplateIndex, this._readAttrNameAndValues(null, directives, ast.attrs), variableNameAndValues, directives, isMerged, ast.ngContentIndex, childVisitor.result)); + this.transitiveNgContentCount += childVisitor.transitiveNgContentCount; + this.embeddedTemplateIndex = childVisitor.embeddedTemplateIndex; + return null; + }; + CommandBuilderVisitor.prototype.visitElement = function(ast, context) { + var _this = this; + var component = ast.getComponent(); + var eventTargetAndNames = visitAndReturnContext(this, ast.events, []); + var variableNameAndValues = []; + if (lang_1.isBlank(component)) { + ast.exportAsVars.forEach(function(varAst) { + variableNameAndValues.push(varAst.name); + variableNameAndValues.push(null); + }); + } + var directives = []; + collection_1.ListWrapper.forEachWithIndex(ast.directives, function(directiveAst, index) { + directiveAst.visit(_this, new DirectiveContext(index, eventTargetAndNames, variableNameAndValues, directives)); + }); + eventTargetAndNames = removeKeyValueArrayDuplicates(eventTargetAndNames); + var attrNameAndValues = this._readAttrNameAndValues(component, directives, ast.attrs); + if (lang_1.isPresent(component)) { + this.result.push(this.commandFactory.createBeginComponent(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, component.template.encapsulation === api_1.ViewEncapsulation.Native, ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndComponent()); + } else { + this.result.push(this.commandFactory.createBeginElement(ast.name, attrNameAndValues, eventTargetAndNames, variableNameAndValues, directives, ast.isBound(), ast.ngContentIndex)); + template_ast_1.templateVisitAll(this, ast.children); + this.result.push(this.commandFactory.createEndElement()); + } + return null; + }; + CommandBuilderVisitor.prototype.visitVariable = function(ast, ctx) { + return null; + }; + CommandBuilderVisitor.prototype.visitAttr = function(ast, attrNameAndValues) { + attrNameAndValues.push(ast.name); + attrNameAndValues.push(ast.value); + return null; + }; + CommandBuilderVisitor.prototype.visitBoundText = function(ast, context) { + this.result.push(this.commandFactory.createText(null, true, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitText = function(ast, context) { + this.result.push(this.commandFactory.createText(ast.value, false, ast.ngContentIndex)); + return null; + }; + CommandBuilderVisitor.prototype.visitDirective = function(ast, ctx) { + ctx.targetDirectives.push(ast.directive); + template_ast_1.templateVisitAll(this, ast.hostEvents, ctx.eventTargetAndNames); + ast.exportAsVars.forEach(function(varAst) { + ctx.targetVariableNameAndValues.push(varAst.name); + ctx.targetVariableNameAndValues.push(ctx.index); + }); + return null; + }; + CommandBuilderVisitor.prototype.visitEvent = function(ast, eventTargetAndNames) { + eventTargetAndNames.push(ast.target); + eventTargetAndNames.push(ast.name); + return null; + }; + CommandBuilderVisitor.prototype.visitDirectiveProperty = function(ast, context) { + return null; + }; + CommandBuilderVisitor.prototype.visitElementProperty = function(ast, context) { + return null; + }; + return CommandBuilderVisitor; + })(); + function removeKeyValueArrayDuplicates(keyValueArray) { + var knownPairs = new Set(); + var resultKeyValueArray = []; + for (var i = 0; i < keyValueArray.length; i += 2) { + var key = keyValueArray[i]; + var value = keyValueArray[i + 1]; + var pairId = key + ":" + value; + if (!collection_1.SetWrapper.has(knownPairs, pairId)) { + resultKeyValueArray.push(key); + resultKeyValueArray.push(value); + knownPairs.add(pairId); + } + } + return resultKeyValueArray; + } + var DirectiveContext = (function() { + function DirectiveContext(index, eventTargetAndNames, targetVariableNameAndValues, targetDirectives) { + this.index = index; + this.eventTargetAndNames = eventTargetAndNames; + this.targetVariableNameAndValues = targetVariableNameAndValues; + this.targetDirectives = targetDirectives; + } + return DirectiveContext; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_ast", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var HtmlTextAst = (function() { + function HtmlTextAst(value, sourceInfo) { + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlTextAst.prototype.visit = function(visitor, context) { + return visitor.visitText(this, context); + }; + return HtmlTextAst; + })(); + exports.HtmlTextAst = HtmlTextAst; + var HtmlAttrAst = (function() { + function HtmlAttrAst(name, value, sourceInfo) { + this.name = name; + this.value = value; + this.sourceInfo = sourceInfo; + } + HtmlAttrAst.prototype.visit = function(visitor, context) { + return visitor.visitAttr(this, context); + }; + return HtmlAttrAst; + })(); + exports.HtmlAttrAst = HtmlAttrAst; + var HtmlElementAst = (function() { + function HtmlElementAst(name, attrs, children, sourceInfo) { + this.name = name; + this.attrs = attrs; + this.children = children; + this.sourceInfo = sourceInfo; + } + HtmlElementAst.prototype.visit = function(visitor, context) { + return visitor.visitElement(this, context); + }; + return HtmlElementAst; + })(); + exports.HtmlElementAst = HtmlElementAst; + function htmlVisitAll(visitor, asts, context) { + if (context === void 0) { + context = null; + } + var result = []; + asts.forEach(function(ast) { + var astResult = ast.visit(visitor, context); + if (lang_1.isPresent(astResult)) { + result.push(astResult); + } + }); + return result; + } + exports.htmlVisitAll = htmlVisitAll; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/schema/element_schema_registry", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ElementSchemaRegistry = (function() { + function ElementSchemaRegistry() {} + ElementSchemaRegistry.prototype.hasProperty = function(tagName, propName) { + return true; + }; + ElementSchemaRegistry.prototype.getMappedPropName = function(propName) { + return propName; + }; + return ElementSchemaRegistry; + })(); + exports.ElementSchemaRegistry = ElementSchemaRegistry; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_preparser", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var NG_CONTENT_SELECT_ATTR = 'select'; + var NG_CONTENT_ELEMENT = 'ng-content'; + var LINK_ELEMENT = 'link'; + var LINK_STYLE_REL_ATTR = 'rel'; + var LINK_STYLE_HREF_ATTR = 'href'; + var LINK_STYLE_REL_VALUE = 'stylesheet'; + var STYLE_ELEMENT = 'style'; + var SCRIPT_ELEMENT = 'script'; + var NG_NON_BINDABLE_ATTR = 'ng-non-bindable'; + function preparseElement(ast) { + var selectAttr = null; + var hrefAttr = null; + var relAttr = null; + var nonBindable = false; + ast.attrs.forEach(function(attr) { + if (attr.name == NG_CONTENT_SELECT_ATTR) { + selectAttr = attr.value; + } else if (attr.name == LINK_STYLE_HREF_ATTR) { + hrefAttr = attr.value; + } else if (attr.name == LINK_STYLE_REL_ATTR) { + relAttr = attr.value; + } else if (attr.name == NG_NON_BINDABLE_ATTR) { + nonBindable = true; + } + }); + selectAttr = normalizeNgContentSelect(selectAttr); + var nodeName = ast.name; + var type = PreparsedElementType.OTHER; + if (nodeName == NG_CONTENT_ELEMENT) { + type = PreparsedElementType.NG_CONTENT; + } else if (nodeName == STYLE_ELEMENT) { + type = PreparsedElementType.STYLE; + } else if (nodeName == SCRIPT_ELEMENT) { + type = PreparsedElementType.SCRIPT; + } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { + type = PreparsedElementType.STYLESHEET; + } + return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable); + } + exports.preparseElement = preparseElement; + (function(PreparsedElementType) { + PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; + PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; + PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; + PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; + PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; + })(exports.PreparsedElementType || (exports.PreparsedElementType = {})); + var PreparsedElementType = exports.PreparsedElementType; + var PreparsedElement = (function() { + function PreparsedElement(type, selectAttr, hrefAttr, nonBindable) { + this.type = type; + this.selectAttr = selectAttr; + this.hrefAttr = hrefAttr; + this.nonBindable = nonBindable; + } + return PreparsedElement; + })(); + exports.PreparsedElement = PreparsedElement; + function normalizeNgContentSelect(selectAttr) { + if (lang_1.isBlank(selectAttr) || selectAttr.length === 0) { + return '*'; + } + return selectAttr; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_normalizer", ["angular2/src/compiler/directive_metadata", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/compiler/html_ast", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_preparser"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var TemplateNormalizer = (function() { + function TemplateNormalizer(_xhr, _urlResolver, _domParser) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._domParser = _domParser; + } + TemplateNormalizer.prototype.normalizeTemplate = function(directiveType, template) { + var _this = this; + if (lang_1.isPresent(template.template)) { + return async_1.PromiseWrapper.resolve(this.normalizeLoadedTemplate(directiveType, template, template.template, directiveType.moduleId)); + } else if (lang_1.isPresent(template.templateUrl)) { + var sourceAbsUrl = this._urlResolver.resolve(directiveType.moduleId, template.templateUrl); + return this._xhr.get(sourceAbsUrl).then(function(templateContent) { + return _this.normalizeLoadedTemplate(directiveType, template, templateContent, sourceAbsUrl); + }); + } else { + throw new exceptions_1.BaseException("No template specified for component " + directiveType.name); + } + }; + TemplateNormalizer.prototype.normalizeLoadedTemplate = function(directiveType, templateMeta, template, templateAbsUrl) { + var _this = this; + var domNodes = this._domParser.parse(template, directiveType.name); + var visitor = new TemplatePreparseVisitor(); + html_ast_1.htmlVisitAll(visitor, domNodes); + var allStyles = templateMeta.styles.concat(visitor.styles); + var allStyleAbsUrls = visitor.styleUrls.map(function(url) { + return _this._urlResolver.resolve(templateAbsUrl, url); + }).concat(templateMeta.styleUrls.map(function(url) { + return _this._urlResolver.resolve(directiveType.moduleId, url); + })); + var allResolvedStyles = allStyles.map(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, templateAbsUrl, style); + styleWithImports.styleUrls.forEach(function(styleUrl) { + return allStyleAbsUrls.push(styleUrl); + }); + return styleWithImports.style; + }); + var encapsulation = templateMeta.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated && allResolvedStyles.length === 0 && allStyleAbsUrls.length === 0) { + encapsulation = api_1.ViewEncapsulation.None; + } + return new directive_metadata_1.CompileTemplateMetadata({ + encapsulation: encapsulation, + template: template, + templateUrl: templateAbsUrl, + styles: allResolvedStyles, + styleUrls: allStyleAbsUrls, + ngContentSelectors: visitor.ngContentSelectors + }); + }; + TemplateNormalizer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver, html_parser_1.HtmlParser])], TemplateNormalizer); + return TemplateNormalizer; + })(); + exports.TemplateNormalizer = TemplateNormalizer; + var TemplatePreparseVisitor = (function() { + function TemplatePreparseVisitor() { + this.ngContentSelectors = []; + this.styles = []; + this.styleUrls = []; + this.ngNonBindableStackCount = 0; + } + TemplatePreparseVisitor.prototype.visitElement = function(ast, context) { + var preparsedElement = template_preparser_1.preparseElement(ast); + switch (preparsedElement.type) { + case template_preparser_1.PreparsedElementType.NG_CONTENT: + if (this.ngNonBindableStackCount === 0) { + this.ngContentSelectors.push(preparsedElement.selectAttr); + } + break; + case template_preparser_1.PreparsedElementType.STYLE: + var textContent = ''; + ast.children.forEach(function(child) { + if (child instanceof html_ast_1.HtmlTextAst) { + textContent += child.value; + } + }); + this.styles.push(textContent); + break; + case template_preparser_1.PreparsedElementType.STYLESHEET: + this.styleUrls.push(preparsedElement.hrefAttr); + break; + } + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount++; + } + html_ast_1.htmlVisitAll(this, ast.children); + if (preparsedElement.nonBindable) { + this.ngNonBindableStackCount--; + } + return null; + }; + TemplatePreparseVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + TemplatePreparseVisitor.prototype.visitText = function(ast, context) { + return null; + }; + return TemplatePreparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/runtime_metadata", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/compiler/directive_metadata", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/compiler/interfaces", "angular2/src/core/reflection/reflection", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cpl = require("angular2/src/compiler/directive_metadata"); + var dirAnn = require("angular2/src/core/metadata/directives"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var di_2 = require("angular2/src/core/di"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var RuntimeMetadataResolver = (function() { + function RuntimeMetadataResolver(_directiveResolver, _viewResolver) { + this._directiveResolver = _directiveResolver; + this._viewResolver = _viewResolver; + this._directiveCounter = 0; + this._cache = new Map(); + } + RuntimeMetadataResolver.prototype.getMetadata = function(directiveType) { + var meta = this._cache.get(directiveType); + if (lang_1.isBlank(meta)) { + var directiveAnnotation = this._directiveResolver.resolve(directiveType); + var moduleId = calcModuleId(directiveType, directiveAnnotation); + var templateMeta = null; + var changeDetectionStrategy = null; + if (directiveAnnotation instanceof dirAnn.ComponentMetadata) { + var compAnnotation = directiveAnnotation; + var viewAnnotation = this._viewResolver.resolve(directiveType); + templateMeta = new cpl.CompileTemplateMetadata({ + encapsulation: viewAnnotation.encapsulation, + template: viewAnnotation.template, + templateUrl: viewAnnotation.templateUrl, + styles: viewAnnotation.styles, + styleUrls: viewAnnotation.styleUrls + }); + changeDetectionStrategy = compAnnotation.changeDetection; + } + meta = cpl.CompileDirectiveMetadata.create({ + selector: directiveAnnotation.selector, + exportAs: directiveAnnotation.exportAs, + isComponent: lang_1.isPresent(templateMeta), + dynamicLoadable: true, + type: new cpl.CompileTypeMetadata({ + id: this._directiveCounter++, + name: lang_1.stringify(directiveType), + moduleId: moduleId, + runtime: directiveType + }), + template: templateMeta, + changeDetection: changeDetectionStrategy, + properties: directiveAnnotation.properties, + events: directiveAnnotation.events, + host: directiveAnnotation.host, + lifecycleHooks: collection_1.ListWrapper.filter(interfaces_1.LIFECYCLE_HOOKS_VALUES, function(hook) { + return directive_lifecycle_reflector_1.hasLifecycleHook(hook, directiveType); + }) + }); + this._cache.set(directiveType, meta); + } + return meta; + }; + RuntimeMetadataResolver.prototype.getViewDirectivesMetadata = function(component) { + var _this = this; + var view = this._viewResolver.resolve(component); + var directives = flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + return removeDuplicatedDirectives(directives.map(function(type) { + return _this.getMetadata(type); + })); + }; + RuntimeMetadataResolver = __decorate([di_2.Injectable(), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, view_resolver_1.ViewResolver])], RuntimeMetadataResolver); + return RuntimeMetadataResolver; + })(); + exports.RuntimeMetadataResolver = RuntimeMetadataResolver; + function removeDuplicatedDirectives(directives) { + var directivesMap = new Map(); + directives.forEach(function(dirMeta) { + directivesMap.set(dirMeta.type.id, dirMeta); + }); + return collection_1.MapWrapper.values(directivesMap); + } + function flattenDirectives(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + flattenList(view.directives, directives); + return directives; + } + function flattenList(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + flattenList(item, out); + } else { + out.push(item); + } + } + } + function isValidDirective(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type); + } + function calcModuleId(type, directiveAnnotation) { + if (lang_1.isPresent(directiveAnnotation.moduleId)) { + return directiveAnnotation.moduleId; + } else { + return reflection_1.reflector.moduleId(type); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/services", ["angular2/src/core/services/app_root_url", "angular2/src/core/services/url_resolver"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + exports.AppRootUrl = app_root_url_1.AppRootUrl; + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + exports.UrlResolver = url_resolver_1.UrlResolver; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler", ["angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/compiler", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/query_list", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/dynamic_component_loader"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + exports.ComponentUrlMapper = component_url_mapper_1.ComponentUrlMapper; + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + exports.DirectiveResolver = directive_resolver_1.DirectiveResolver; + var compiler_1 = require("angular2/src/core/compiler/compiler"); + exports.Compiler = compiler_1.Compiler; + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + exports.AppViewManager = view_manager_1.AppViewManager; + var query_list_1 = require("angular2/src/core/compiler/query_list"); + exports.QueryList = query_list_1.QueryList; + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.DynamicComponentLoader = dynamic_component_loader_1.DynamicComponentLoader; + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + exports.ElementRef = element_ref_1.ElementRef; + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + exports.TemplateRef = template_ref_1.TemplateRef; + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + exports.ViewRef = view_ref_1.ViewRef; + exports.ProtoViewRef = view_ref_1.ProtoViewRef; + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + exports.ViewContainerRef = view_container_ref_1.ViewContainerRef; + var dynamic_component_loader_2 = require("angular2/src/core/compiler/dynamic_component_loader"); + exports.ComponentRef = dynamic_component_loader_2.ComponentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/lifecycle", ["angular2/src/core/life_cycle/life_cycle"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + exports.LifeCycle = life_cycle_1.LifeCycle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/zone", ["angular2/src/core/zone/ng_zone"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + exports.NgZone = ng_zone_1.NgZone; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_inliner", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/core/facade/collection", "angular2/src/core/services/url_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/facade/lang", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var collection_1 = require("angular2/src/core/facade/collection"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var StyleInliner = (function() { + function StyleInliner(_xhr, _styleUrlResolver, _urlResolver) { + this._xhr = _xhr; + this._styleUrlResolver = _styleUrlResolver; + this._urlResolver = _urlResolver; + } + StyleInliner.prototype.inlineImports = function(cssText, baseUrl) { + return this._inlineImports(cssText, baseUrl, []); + }; + StyleInliner.prototype._inlineImports = function(cssText, baseUrl, inlinedUrls) { + var _this = this; + var partIndex = 0; + var parts = lang_1.StringWrapper.split(cssText, _importRe); + if (parts.length === 1) { + return cssText; + } + var promises = []; + while (partIndex < parts.length - 1) { + var prefix = parts[partIndex]; + var rule = parts[partIndex + 1]; + var url = _extractUrl(rule); + if (lang_1.isPresent(url)) { + url = this._urlResolver.resolve(baseUrl, url); + } + var mediaQuery = _extractMediaQuery(rule); + var promise; + if (lang_1.isBlank(url)) { + promise = async_1.PromiseWrapper.resolve("/* Invalid import rule: \"@import " + rule + ";\" */"); + } else if (collection_1.ListWrapper.contains(inlinedUrls, url)) { + promise = async_1.PromiseWrapper.resolve(prefix); + } else { + inlinedUrls.push(url); + promise = async_1.PromiseWrapper.then(this._xhr.get(url), function(rawCss) { + var inlinedCss = _this._inlineImports(rawCss, url, inlinedUrls); + if (lang_1.isPromise(inlinedCss)) { + return inlinedCss.then(function(css) { + return prefix + _this._transformImportedCss(css, mediaQuery, url) + '\n'; + }); + } else { + return prefix + _this._transformImportedCss(inlinedCss, mediaQuery, url) + '\n'; + } + }, function(error) { + return ("/* failed to import " + url + " */\n"); + }); + } + promises.push(promise); + partIndex += 2; + } + return async_1.PromiseWrapper.all(promises).then(function(cssParts) { + var cssText = cssParts.join(''); + if (partIndex < parts.length) { + cssText += parts[partIndex]; + } + return cssText; + }); + }; + StyleInliner.prototype._transformImportedCss = function(css, mediaQuery, url) { + css = this._styleUrlResolver.resolveUrls(css, url); + return _wrapInMediaRule(css, mediaQuery); + }; + StyleInliner = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_url_resolver_1.StyleUrlResolver, url_resolver_1.UrlResolver])], StyleInliner); + return StyleInliner; + })(); + exports.StyleInliner = StyleInliner; + function _extractUrl(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_urlRe, importRule); + if (lang_1.isBlank(match)) + return null; + return lang_1.isPresent(match[1]) ? match[1] : match[2]; + } + function _extractMediaQuery(importRule) { + var match = lang_1.RegExpWrapper.firstMatch(_mediaQueryRe, importRule); + if (lang_1.isBlank(match)) + return null; + var mediaQuery = match[1].trim(); + return (mediaQuery.length > 0) ? mediaQuery : null; + } + function _wrapInMediaRule(css, query) { + return (lang_1.isBlank(query)) ? css : "@media " + query + " {\n" + css + "\n}"; + } + var _importRe = /@import\s+([^;]+);/g; + var _urlRe = lang_1.RegExpWrapper.create('url\\(\\s*?[\'"]?([^\'")]+)[\'"]?|' + '[\'"]([^\'")]+)[\'"]'); + var _mediaQueryRe = /['"][^'"]+['"]\s*\)?\s*(.*)/g; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_tokens", ["angular2/src/core/di", "angular2/src/core/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/core/facade/lang"); + exports.DOCUMENT = lang_1.CONST_EXPR(new di_1.OpaqueToken('DocumentToken')); + exports.APP_ID = lang_1.CONST_EXPR(new di_1.OpaqueToken('AppId')); + function _appIdRandomBindingFactory() { + return "" + _randomChar() + _randomChar() + _randomChar(); + } + exports.APP_ID_RANDOM_BINDING = lang_1.CONST_EXPR(new di_1.Binding(exports.APP_ID, { + toFactory: _appIdRandomBindingFactory, + deps: [] + })); + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = lang_1.CONST_EXPR(new di_1.OpaqueToken('MaxInMemoryElementsPerTemplate')); + function _randomChar() { + return lang_1.StringWrapper.fromCharCode(97 + lang_1.Math.floor(lang_1.Math.random() * 25)); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_element", ["angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileElement = (function() { + function CompileElement(element, compilationUnit) { + if (compilationUnit === void 0) { + compilationUnit = ''; + } + this.element = element; + this._attrs = null; + this._classList = null; + this.isViewRoot = false; + this.inheritedProtoView = null; + this.distanceToInheritedBinder = 0; + this.inheritedElementBinder = null; + this.compileChildren = true; + var tplDesc = lang_1.assertionsEnabled() ? getElementDescription(element) : null; + if (compilationUnit !== '') { + this.elementDescription = compilationUnit; + if (lang_1.isPresent(tplDesc)) + this.elementDescription += ": " + tplDesc; + } else { + this.elementDescription = tplDesc; + } + } + CompileElement.prototype.isBound = function() { + return lang_1.isPresent(this.inheritedElementBinder) && this.distanceToInheritedBinder === 0; + }; + CompileElement.prototype.bindElement = function() { + if (!this.isBound()) { + var parentBinder = this.inheritedElementBinder; + this.inheritedElementBinder = this.inheritedProtoView.bindElement(this.element, this.elementDescription); + if (lang_1.isPresent(parentBinder)) { + this.inheritedElementBinder.setParent(parentBinder, this.distanceToInheritedBinder); + } + this.distanceToInheritedBinder = 0; + } + return this.inheritedElementBinder; + }; + CompileElement.prototype.attrs = function() { + if (lang_1.isBlank(this._attrs)) { + this._attrs = dom_adapter_1.DOM.attributeMap(this.element); + } + return this._attrs; + }; + CompileElement.prototype.classList = function() { + if (lang_1.isBlank(this._classList)) { + this._classList = []; + var elClassList = dom_adapter_1.DOM.classList(this.element); + for (var i = 0; i < elClassList.length; i++) { + this._classList.push(elClassList[i]); + } + } + return this._classList; + }; + return CompileElement; + })(); + exports.CompileElement = CompileElement; + function getElementDescription(domElement) { + var buf = new lang_1.StringJoiner(); + var atts = dom_adapter_1.DOM.attributeMap(domElement); + buf.add("<"); + buf.add(dom_adapter_1.DOM.tagName(domElement).toLowerCase()); + addDescriptionAttribute(buf, "id", atts.get("id")); + addDescriptionAttribute(buf, "class", atts.get("class")); + collection_1.MapWrapper.forEach(atts, function(attValue, attName) { + if (attName !== "id" && attName !== "class") { + addDescriptionAttribute(buf, attName, attValue); + } + }); + buf.add(">"); + return buf.toString(); + } + function addDescriptionAttribute(buffer, attName, attValue) { + if (lang_1.isPresent(attValue)) { + if (attValue.length === 0) { + buffer.add(' ' + attName); + } else { + buffer.add(' ' + attName + '="' + attValue + '"'); + } + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_control", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var CompileControl = (function() { + function CompileControl(_steps) { + this._steps = _steps; + this._currentStepIndex = 0; + this._parent = null; + this._results = null; + this._additionalChildren = null; + } + CompileControl.prototype.internalProcess = function(results, startStepIndex, parent, current) { + this._results = results; + var previousStepIndex = this._currentStepIndex; + var previousParent = this._parent; + this._ignoreCurrentElement = false; + for (var i = startStepIndex; i < this._steps.length && !this._ignoreCurrentElement; i++) { + var step = this._steps[i]; + this._parent = parent; + this._currentStepIndex = i; + step.processElement(parent, current, this); + parent = this._parent; + } + if (!this._ignoreCurrentElement) { + results.push(current); + } + this._currentStepIndex = previousStepIndex; + this._parent = previousParent; + var localAdditionalChildren = this._additionalChildren; + this._additionalChildren = null; + return localAdditionalChildren; + }; + CompileControl.prototype.addParent = function(newElement) { + this.internalProcess(this._results, this._currentStepIndex + 1, this._parent, newElement); + this._parent = newElement; + }; + CompileControl.prototype.addChild = function(element) { + if (lang_1.isBlank(this._additionalChildren)) { + this._additionalChildren = []; + } + this._additionalChildren.push(element); + }; + CompileControl.prototype.ignoreCurrentElement = function() { + this._ignoreCurrentElement = true; + }; + return CompileControl; + })(); + exports.CompileControl = CompileControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view", ["angular2/src/core/render/api", "angular2/src/core/dom/dom_adapter"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + function resolveInternalDomProtoView(protoViewRef) { + return protoViewRef._protoView; + } + exports.resolveInternalDomProtoView = resolveInternalDomProtoView; + var DomProtoViewRef = (function(_super) { + __extends(DomProtoViewRef, _super); + function DomProtoViewRef(_protoView) { + _super.call(this); + this._protoView = _protoView; + } + return DomProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.DomProtoViewRef = DomProtoViewRef; + var DomProtoView = (function() { + function DomProtoView(type, cloneableTemplate, encapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment) { + this.type = type; + this.cloneableTemplate = cloneableTemplate; + this.encapsulation = encapsulation; + this.elementBinders = elementBinders; + this.hostAttributes = hostAttributes; + this.rootTextNodeIndices = rootTextNodeIndices; + this.boundTextNodeCount = boundTextNodeCount; + this.fragmentsRootNodeCount = fragmentsRootNodeCount; + this.isSingleElementFragment = isSingleElementFragment; + } + DomProtoView.create = function(templateCloner, type, rootElement, viewEncapsulation, fragmentsRootNodeCount, rootTextNodeIndices, elementBinders, hostAttributes) { + var boundTextNodeCount = rootTextNodeIndices.length; + for (var i = 0; i < elementBinders.length; i++) { + boundTextNodeCount += elementBinders[i].textNodeIndices.length; + } + var isSingleElementFragment = fragmentsRootNodeCount.length === 1 && fragmentsRootNodeCount[0] === 1 && dom_adapter_1.DOM.isElementNode(dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.content(rootElement))); + return new DomProtoView(type, templateCloner.prepareForClone(rootElement), viewEncapsulation, elementBinders, hostAttributes, rootTextNodeIndices, boundTextNodeCount, fragmentsRootNodeCount, isSingleElementFragment); + }; + return DomProtoView; + })(); + exports.DomProtoView = DomProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/element_binder", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var DomElementBinder = (function() { + function DomElementBinder(_a) { + var _b = _a === void 0 ? {} : _a, + textNodeIndices = _b.textNodeIndices, + hasNestedProtoView = _b.hasNestedProtoView, + eventLocals = _b.eventLocals, + localEvents = _b.localEvents, + globalEvents = _b.globalEvents, + hasNativeShadowRoot = _b.hasNativeShadowRoot; + this.textNodeIndices = textNodeIndices; + this.hasNestedProtoView = hasNestedProtoView; + this.eventLocals = eventLocals; + this.localEvents = localEvents; + this.globalEvents = globalEvents; + this.hasNativeShadowRoot = lang_1.isPresent(hasNativeShadowRoot) ? hasNativeShadowRoot : false; + } + return DomElementBinder; + })(); + exports.DomElementBinder = DomElementBinder; + var Event = (function() { + function Event(name, target, fullName) { + this.name = name; + this.target = target; + this.fullName = fullName; + } + return Event; + })(); + exports.Event = Event; + var HostAction = (function() { + function HostAction(actionName, actionExpression, expression) { + this.actionName = actionName; + this.actionExpression = actionExpression; + this.expression = expression; + } + return HostAction; + })(); + exports.HostAction = HostAction; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/property_binding_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var util_1 = require("angular2/src/core/render/dom/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var PropertyBindingParser = (function() { + function PropertyBindingParser(_parser) { + this._parser = _parser; + } + PropertyBindingParser.prototype.processStyle = function(style) { + return style; + }; + PropertyBindingParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var newAttrs = new Map(); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + attrName = _this._normalizeAttributeName(attrName); + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + if (lang_1.isPresent(bindParts)) { + if (lang_1.isPresent(bindParts[1])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + var value = attrValue == '' ? '\$implicit' : attrValue; + _this._bindVariable(identifier, value, current, newAttrs); + } else if (lang_1.isPresent(bindParts[3])) { + _this._bindEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[4])) { + _this._bindProperty(bindParts[5], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[5], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[6])) { + _this._bindProperty(bindParts[6], attrValue, current, newAttrs); + _this._bindAssignmentEvent(bindParts[6], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[7])) { + _this._bindProperty(bindParts[7], attrValue, current, newAttrs); + } else if (lang_1.isPresent(bindParts[8])) { + _this._bindEvent(bindParts[8], attrValue, current, newAttrs); + } + } else { + var expr = _this._parser.parseInterpolation(attrValue, current.elementDescription); + if (lang_1.isPresent(expr)) { + _this._bindPropertyAst(attrName, expr, current, newAttrs); + } + } + }); + collection_1.MapWrapper.forEach(newAttrs, function(attrValue, attrName) { + attrs.set(attrName, attrValue); + }); + }; + PropertyBindingParser.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + PropertyBindingParser.prototype._bindVariable = function(identifier, value, current, newAttrs) { + current.bindElement().bindVariable(util_1.dashCaseToCamelCase(identifier), value); + newAttrs.set(identifier, value); + }; + PropertyBindingParser.prototype._bindProperty = function(name, expression, current, newAttrs) { + this._bindPropertyAst(name, this._parser.parseBinding(expression, current.elementDescription), current, newAttrs); + }; + PropertyBindingParser.prototype._bindPropertyAst = function(name, ast, current, newAttrs) { + var binder = current.bindElement(); + binder.bindProperty(util_1.dashCaseToCamelCase(name), ast); + newAttrs.set(name, ast.source); + }; + PropertyBindingParser.prototype._bindAssignmentEvent = function(name, expression, current, newAttrs) { + this._bindEvent(name, expression + "=$event", current, newAttrs); + }; + PropertyBindingParser.prototype._bindEvent = function(name, expression, current, newAttrs) { + current.bindElement().bindEvent(util_1.dashCaseToCamelCase(name), this._parser.parseAction(expression, current.elementDescription)); + }; + return PropertyBindingParser; + })(); + exports.PropertyBindingParser = PropertyBindingParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/text_interpolation_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var TextInterpolationParser = (function() { + function TextInterpolationParser(_parser) { + this._parser = _parser; + } + TextInterpolationParser.prototype.processStyle = function(style) { + return style; + }; + TextInterpolationParser.prototype.processElement = function(parent, current, control) { + if (!current.compileChildren) { + return ; + } + var element = current.element; + var childNodes = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.templateAwareRoot(element)); + for (var i = 0; i < childNodes.length; i++) { + var node = childNodes[i]; + if (dom_adapter_1.DOM.isTextNode(node)) { + var textNode = node; + var text = dom_adapter_1.DOM.nodeValue(textNode); + var expr = this._parser.parseInterpolation(text, current.elementDescription); + if (lang_1.isPresent(expr)) { + dom_adapter_1.DOM.setText(textNode, ' '); + if (current.element === current.inheritedProtoView.rootElement) { + current.inheritedProtoView.bindRootText(textNode, expr); + } else { + current.bindElement().bindText(textNode, expr); + } + } + } + } + }; + return TextInterpolationParser; + })(); + exports.TextInterpolationParser = TextInterpolationParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/directive_parser", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var DirectiveParser = (function() { + function DirectiveParser(_parser, _directives) { + this._parser = _parser; + this._directives = _directives; + this._selectorMatcher = new selector_1.SelectorMatcher(); + for (var i = 0; i < _directives.length; i++) { + var directive = _directives[i]; + var selector = selector_1.CssSelector.parse(directive.selector); + this._selectorMatcher.addSelectables(selector, i); + } + } + DirectiveParser.prototype.processStyle = function(style) { + return style; + }; + DirectiveParser.prototype.processElement = function(parent, current, control) { + var _this = this; + var attrs = current.attrs(); + var classList = current.classList(); + var cssSelector = new selector_1.CssSelector(); + var foundDirectiveIndices = []; + var elementBinder = null; + cssSelector.setElement(dom_adapter_1.DOM.nodeName(current.element)); + for (var i = 0; i < classList.length; i++) { + cssSelector.addClassName(classList[i]); + } + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + cssSelector.addAttribute(attrName, attrValue); + }); + this._selectorMatcher.match(cssSelector, function(selector, directiveIndex) { + var directive = _this._directives[directiveIndex]; + elementBinder = current.bindElement(); + if (directive.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + _this._ensureHasOnlyOneComponent(elementBinder, current.elementDescription); + collection_1.ListWrapper.insert(foundDirectiveIndices, 0, directiveIndex); + elementBinder.setComponentId(directive.id); + } else { + foundDirectiveIndices.push(directiveIndex); + } + }); + collection_1.ListWrapper.forEach(foundDirectiveIndices, function(directiveIndex) { + var dirMetadata = _this._directives[directiveIndex]; + var directiveBinderBuilder = elementBinder.bindDirective(directiveIndex); + current.compileChildren = current.compileChildren && dirMetadata.compileChildren; + if (lang_1.isPresent(dirMetadata.properties)) { + collection_1.ListWrapper.forEach(dirMetadata.properties, function(bindConfig) { + _this._bindDirectiveProperty(bindConfig, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostListeners)) { + _this._sortedKeysForEach(dirMetadata.hostListeners, function(action, eventName) { + _this._bindDirectiveEvent(eventName, action, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostProperties)) { + _this._sortedKeysForEach(dirMetadata.hostProperties, function(expression, hostPropertyName) { + _this._bindHostProperty(hostPropertyName, expression, current, directiveBinderBuilder); + }); + } + if (lang_1.isPresent(dirMetadata.hostAttributes)) { + _this._sortedKeysForEach(dirMetadata.hostAttributes, function(hostAttrValue, hostAttrName) { + _this._addHostAttribute(hostAttrName, hostAttrValue, current); + }); + } + if (lang_1.isPresent(dirMetadata.readAttributes)) { + collection_1.ListWrapper.forEach(dirMetadata.readAttributes, function(attrName) { + elementBinder.readAttribute(attrName); + }); + } + }); + }; + DirectiveParser.prototype._sortedKeysForEach = function(map, fn) { + var keys = collection_1.MapWrapper.keys(map); + collection_1.ListWrapper.sort(keys, function(a, b) { + var compareVal = lang_1.StringWrapper.compare(a, b); + return compareVal == 0 ? -1 : compareVal; + }); + collection_1.ListWrapper.forEach(keys, function(key) { + fn(collection_1.MapWrapper.get(map, key), key); + }); + }; + DirectiveParser.prototype._ensureHasOnlyOneComponent = function(elementBinder, elDescription) { + if (lang_1.isPresent(elementBinder.componentId)) { + throw new exceptions_1.BaseException("Only one component directive is allowed per element - check " + elDescription); + } + }; + DirectiveParser.prototype._bindDirectiveProperty = function(bindConfig, compileElement, directiveBinderBuilder) { + var dirProperty; + var elProp; + var pipes; + var assignIndex = bindConfig.indexOf(':'); + if (assignIndex > -1) { + dirProperty = lang_1.StringWrapper.substring(bindConfig, 0, assignIndex).trim(); + pipes = this._splitBindConfig(lang_1.StringWrapper.substring(bindConfig, assignIndex + 1)); + elProp = collection_1.ListWrapper.removeAt(pipes, 0); + } else { + dirProperty = bindConfig; + elProp = bindConfig; + pipes = []; + } + elProp = util_1.dashCaseToCamelCase(elProp); + var bindingAst = compileElement.bindElement().propertyBindings.get(elProp); + if (lang_1.isBlank(bindingAst)) { + var attributeValue = compileElement.attrs().get(util_1.camelCaseToDashCase(elProp)); + if (lang_1.isPresent(attributeValue)) { + bindingAst = this._parser.wrapLiteralPrimitive(attributeValue, compileElement.elementDescription); + } + } + if (lang_1.isPresent(bindingAst)) { + directiveBinderBuilder.bindProperty(dirProperty, bindingAst, elProp); + } + }; + DirectiveParser.prototype._bindDirectiveEvent = function(eventName, action, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseAction(action, compileElement.elementDescription); + var parsedEvent = event_config_1.EventConfig.parse(eventName); + var targetName = parsedEvent.isLongForm ? parsedEvent.fieldName : null; + directiveBinderBuilder.bindEvent(parsedEvent.eventName, ast, targetName); + }; + DirectiveParser.prototype._bindHostProperty = function(hostPropertyName, expression, compileElement, directiveBinderBuilder) { + var ast = this._parser.parseSimpleBinding(expression, "hostProperties of " + compileElement.elementDescription); + directiveBinderBuilder.bindHostProperty(hostPropertyName, ast); + }; + DirectiveParser.prototype._addHostAttribute = function(attrName, attrValue, compileElement) { + if (lang_1.StringWrapper.equals(attrName, 'class')) { + collection_1.ListWrapper.forEach(attrValue.split(' '), function(className) { + dom_adapter_1.DOM.addClass(compileElement.element, className); + }); + } else if (!dom_adapter_1.DOM.hasAttribute(compileElement.element, attrName)) { + dom_adapter_1.DOM.setAttribute(compileElement.element, attrName, attrValue); + } + }; + DirectiveParser.prototype._splitBindConfig = function(bindConfig) { + return collection_1.ListWrapper.map(bindConfig.split('|'), function(s) { + return s.trim(); + }); + }; + return DirectiveParser; + })(); + exports.DirectiveParser = DirectiveParser; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_splitter", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var util_1 = require("angular2/src/core/render/dom/util"); + var ViewSplitter = (function() { + function ViewSplitter(_parser) { + this._parser = _parser; + } + ViewSplitter.prototype.processStyle = function(style) { + return style; + }; + ViewSplitter.prototype.processElement = function(parent, current, control) { + var attrs = current.attrs(); + var templateBindings = attrs.get('template'); + var hasTemplateBinding = lang_1.isPresent(templateBindings); + collection_1.MapWrapper.forEach(attrs, function(attrValue, attrName) { + if (lang_1.StringWrapper.startsWith(attrName, '*')) { + var key = lang_1.StringWrapper.substring(attrName, 1); + if (hasTemplateBinding) { + throw new exceptions_1.BaseException("Only one template directive per element is allowed: " + (templateBindings + " and " + key + " cannot be used simultaneously ") + ("in " + current.elementDescription)); + } else { + templateBindings = (attrValue.length == 0) ? key : key + ' ' + attrValue; + hasTemplateBinding = true; + } + } + }); + if (lang_1.isPresent(parent)) { + if (dom_adapter_1.DOM.isTemplateElement(current.element)) { + if (!current.isViewRoot) { + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = current.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + this._moveChildNodes(dom_adapter_1.DOM.content(current.element), dom_adapter_1.DOM.content(viewRoot.element)); + control.addChild(viewRoot); + } + } + if (hasTemplateBinding) { + var anchor = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + anchor.inheritedProtoView = current.inheritedProtoView; + anchor.inheritedElementBinder = current.inheritedElementBinder; + anchor.distanceToInheritedBinder = current.distanceToInheritedBinder; + anchor.elementDescription = current.elementDescription; + var viewRoot = new compile_element_1.CompileElement(dom_adapter_1.DOM.createTemplate('')); + viewRoot.inheritedProtoView = anchor.bindElement().bindNestedProtoView(viewRoot.element); + viewRoot.elementDescription = current.elementDescription; + viewRoot.isViewRoot = true; + current.inheritedProtoView = viewRoot.inheritedProtoView; + current.inheritedElementBinder = null; + current.distanceToInheritedBinder = 0; + this._parseTemplateBindings(templateBindings, anchor); + dom_adapter_1.DOM.insertBefore(current.element, anchor.element); + control.addParent(anchor); + dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(viewRoot.element), current.element); + control.addParent(viewRoot); + } + } + }; + ViewSplitter.prototype._moveChildNodes = function(source, target) { + var next = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(next)) { + dom_adapter_1.DOM.appendChild(target, next); + next = dom_adapter_1.DOM.firstChild(source); + } + }; + ViewSplitter.prototype._parseTemplateBindings = function(templateBindings, compileElement) { + var bindings = this._parser.parseTemplateBindings(templateBindings, compileElement.elementDescription); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + if (binding.keyIsVar) { + compileElement.bindElement().bindVariable(util_1.dashCaseToCamelCase(binding.key), binding.name); + compileElement.attrs().set(binding.key, binding.name); + } else if (lang_1.isPresent(binding.expression)) { + compileElement.bindElement().bindProperty(util_1.dashCaseToCamelCase(binding.key), binding.expression); + compileElement.attrs().set(binding.key, binding.expression.source); + } else { + dom_adapter_1.DOM.setAttribute(compileElement.element, binding.key, ''); + } + } + }; + return ViewSplitter; + })(); + exports.ViewSplitter = ViewSplitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/style_encapsulator", ["angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/render/dom/compiler/shadow_css"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var StyleEncapsulator = (function() { + function StyleEncapsulator(_appId, _view, _componentUIDsCache) { + this._appId = _appId; + this._view = _view; + this._componentUIDsCache = _componentUIDsCache; + } + StyleEncapsulator.prototype.processElement = function(parent, current, control) { + if (util_1.isElementWithTag(current.element, util_1.NG_CONTENT_ELEMENT_NAME)) { + current.inheritedProtoView.bindNgContent(); + } else { + if (this._view.encapsulation === api_1.ViewEncapsulation.Emulated) { + this._processEmulatedScopedElement(current, parent); + } + } + }; + StyleEncapsulator.prototype.processStyle = function(style) { + var encapsulation = this._view.encapsulation; + if (encapsulation === api_1.ViewEncapsulation.Emulated) { + return this._shimCssForComponent(style, this._view.componentId); + } else { + return style; + } + }; + StyleEncapsulator.prototype._processEmulatedScopedElement = function(current, parent) { + var element = current.element; + var hostComponentId = this._view.componentId; + var viewType = current.inheritedProtoView.type; + if (viewType !== api_1.ViewType.HOST && lang_1.isPresent(hostComponentId)) { + var contentAttribute = getContentAttribute(this._getComponentId(hostComponentId)); + dom_adapter_1.DOM.setAttribute(element, contentAttribute, ''); + if (lang_1.isBlank(parent) && viewType == api_1.ViewType.COMPONENT) { + var hostAttribute = getHostAttribute(this._getComponentId(hostComponentId)); + current.inheritedProtoView.setHostAttribute(hostAttribute, ''); + } + } + }; + StyleEncapsulator.prototype._shimCssForComponent = function(cssText, componentId) { + var id = this._getComponentId(componentId); + var shadowCss = new shadow_css_1.ShadowCss(); + return shadowCss.shimCssText(cssText, getContentAttribute(id), getHostAttribute(id)); + }; + StyleEncapsulator.prototype._getComponentId = function(componentStringId) { + var id = this._componentUIDsCache.get(componentStringId); + if (lang_1.isBlank(id)) { + id = this._appId + "-" + this._componentUIDsCache.size; + this._componentUIDsCache.set(componentStringId, id); + } + return id; + }; + return StyleEncapsulator; + })(); + exports.StyleEncapsulator = StyleEncapsulator; + function getHostAttribute(compId) { + return "_nghost-" + compId; + } + function getContentAttribute(compId) { + return "_ngcontent-" + compId; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_merger", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function mergeProtoViewsRecursively(templateCloner, protoViewRefs) { + var clonedProtoViews = []; + var hostViewAndBinderIndices = []; + cloneProtoViews(templateCloner, protoViewRefs, clonedProtoViews, hostViewAndBinderIndices); + var mainProtoView = clonedProtoViews[0]; + mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices); + var fragments = []; + var elementsWithNativeShadowRoot = new Set(); + mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments, elementsWithNativeShadowRoot); + markBoundTextNodeParentsAsBoundElements(clonedProtoViews); + var fragmentsRootNodeCount = fragments.map(function(fragment) { + return fragment.length; + }); + var rootElement = createRootElementFromFragments(fragments); + var rootNode = dom_adapter_1.DOM.content(rootElement); + var mergedBoundElements = util_1.queryBoundElements(rootNode, false); + var mergedBoundTextIndices = new Map(); + var boundTextNodeMap = indexBoundTextNodes(clonedProtoViews); + var rootTextNodeIndices = calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices); + var mergedElementBinders = calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodeMap, mergedBoundTextIndices); + var mappedElementIndices = calcMappedElementIndices(clonedProtoViews, mergedBoundElements); + var mappedTextIndices = calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices); + var hostElementIndicesByViewIndex = calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices); + var nestedViewCounts = calcNestedViewCounts(hostViewAndBinderIndices); + var mergedProtoView = proto_view_1.DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement, mainProtoView.original.encapsulation, fragmentsRootNodeCount, rootTextNodeIndices, mergedElementBinders, new Map()); + return new api_1.RenderProtoViewMergeMapping(new proto_view_1.DomProtoViewRef(mergedProtoView), fragmentsRootNodeCount.length, mappedElementIndices, mergedBoundElements.length, mappedTextIndices, hostElementIndicesByViewIndex, nestedViewCounts); + } + exports.mergeProtoViewsRecursively = mergeProtoViewsRecursively; + function cloneProtoViews(templateCloner, protoViewRefs, targetClonedProtoViews, targetHostViewAndBinderIndices) { + var hostProtoView = proto_view_1.resolveInternalDomProtoView(protoViewRefs[0]); + var hostPvIdx = targetClonedProtoViews.length; + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, hostProtoView, false)); + if (targetHostViewAndBinderIndices.length === 0) { + targetHostViewAndBinderIndices.push([null, null]); + } + var protoViewIdx = 1; + for (var i = 0; i < hostProtoView.elementBinders.length; i++) { + var binder = hostProtoView.elementBinders[i]; + if (binder.hasNestedProtoView) { + var nestedEntry = protoViewRefs[protoViewIdx++]; + if (lang_1.isPresent(nestedEntry)) { + targetHostViewAndBinderIndices.push([hostPvIdx, i]); + if (lang_1.isArray(nestedEntry)) { + cloneProtoViews(templateCloner, nestedEntry, targetClonedProtoViews, targetHostViewAndBinderIndices); + } else { + targetClonedProtoViews.push(util_1.cloneAndQueryProtoView(templateCloner, proto_view_1.resolveInternalDomProtoView(nestedEntry), false)); + } + } + } + } + } + function markBoundTextNodeParentsAsBoundElements(mergableProtoViews) { + mergableProtoViews.forEach(function(mergableProtoView) { + mergableProtoView.boundTextNodes.forEach(function(textNode) { + var parentNode = textNode.parentNode; + if (lang_1.isPresent(parentNode) && dom_adapter_1.DOM.isElementNode(parentNode)) { + dom_adapter_1.DOM.addClass(parentNode, util_1.NG_BINDING_CLASS); + } + }); + }); + } + function indexBoundTextNodes(mergableProtoViews) { + var boundTextNodeMap = new Map(); + for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) { + var mergableProtoView = mergableProtoViews[pvIndex]; + mergableProtoView.boundTextNodes.forEach(function(textNode) { + boundTextNodeMap.set(textNode, null); + }); + } + return boundTextNodeMap; + } + function mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.EMBEDDED) { + var hostComponentIdx = nearestHostComponentOrRootPvIndices[viewIdx]; + var hostPv = clonedProtoViews[hostComponentIdx]; + clonedProtoView.fragments.forEach(function(fragment) { + return hostPv.fragments.push(fragment); + }); + } + } + } + function calcNearestHostComponentOrRootPvIndices(clonedProtoViews, hostViewAndBinderIndices) { + var nearestHostComponentOrRootPvIndices = collection_1.ListWrapper.createFixedSize(clonedProtoViews.length); + nearestHostComponentOrRootPvIndices[0] = null; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + if (hostViewIdx === 0 || hostProtoView.original.type === api_1.ViewType.COMPONENT) { + nearestHostComponentOrRootPvIndices[viewIdx] = hostViewIdx; + } else { + nearestHostComponentOrRootPvIndices[viewIdx] = nearestHostComponentOrRootPvIndices[hostViewIdx]; + } + } + return nearestHostComponentOrRootPvIndices; + } + function mergeComponents(clonedProtoViews, hostViewAndBinderIndices, targetFragments, targetElementsWithNativeShadowRoot) { + var hostProtoView = clonedProtoViews[0]; + hostProtoView.fragments.forEach(function(fragment) { + return targetFragments.push(fragment); + }); + for (var viewIdx = 1; viewIdx < clonedProtoViews.length; viewIdx++) { + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + var hostProtoView = clonedProtoViews[hostViewIdx]; + var clonedProtoView = clonedProtoViews[viewIdx]; + if (clonedProtoView.original.type === api_1.ViewType.COMPONENT) { + mergeComponent(hostProtoView, hostBinderIdx, clonedProtoView, targetFragments, targetElementsWithNativeShadowRoot); + } + } + } + function mergeComponent(hostProtoView, binderIdx, nestedProtoView, targetFragments, targetElementsWithNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + var fragmentElements = mapFragmentsIntoElements(nestedProtoView.fragments); + var contentElements = findContentElements(fragmentElements); + var projectableNodes = dom_adapter_1.DOM.childNodesAsList(hostElement); + for (var i = 0; i < contentElements.length; i++) { + var contentElement = contentElements[i]; + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + projectableNodes = projectMatchingNodes(select, contentElement, projectableNodes); + } + var fragments = extractFragmentNodesFromElements(fragmentElements); + var useNativeShadowRoot = nestedProtoView.original.encapsulation === api_1.ViewEncapsulation.Native; + if (useNativeShadowRoot) { + targetElementsWithNativeShadowRoot.add(hostElement); + } + collection_1.MapWrapper.forEach(nestedProtoView.original.hostAttributes, function(attrValue, attrName) { + dom_adapter_1.DOM.setAttribute(hostElement, attrName, attrValue); + }); + appendComponentNodesToHost(hostProtoView, binderIdx, fragments[0], useNativeShadowRoot); + for (var i = 1; i < fragments.length; i++) { + targetFragments.push(fragments[i]); + } + } + function mapFragmentsIntoElements(fragments) { + return fragments.map(function(fragment) { + var fragmentElement = dom_adapter_1.DOM.createTemplate(''); + fragment.forEach(function(node) { + return dom_adapter_1.DOM.appendChild(dom_adapter_1.DOM.content(fragmentElement), node); + }); + return fragmentElement; + }); + } + function extractFragmentNodesFromElements(fragmentElements) { + return fragmentElements.map(function(fragmentElement) { + return dom_adapter_1.DOM.childNodesAsList(dom_adapter_1.DOM.content(fragmentElement)); + }); + } + function findContentElements(fragmentElements) { + var contentElements = []; + fragmentElements.forEach(function(fragmentElement) { + var fragmentContentElements = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(fragmentElement), util_1.NG_CONTENT_ELEMENT_NAME); + for (var i = 0; i < fragmentContentElements.length; i++) { + contentElements.push(fragmentContentElements[i]); + } + }); + return sortContentElements(contentElements); + } + function appendComponentNodesToHost(hostProtoView, binderIdx, componentRootNodes, useNativeShadowRoot) { + var hostElement = hostProtoView.boundElements[binderIdx]; + if (useNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.createElement(util_1.NG_SHADOW_ROOT_ELEMENT_NAME); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(shadowRootWrapper, componentRootNodes[i]); + } + var firstChild = dom_adapter_1.DOM.firstChild(hostElement); + if (lang_1.isPresent(firstChild)) { + dom_adapter_1.DOM.insertBefore(firstChild, shadowRootWrapper); + } else { + dom_adapter_1.DOM.appendChild(hostElement, shadowRootWrapper); + } + } else { + dom_adapter_1.DOM.clearNodes(hostElement); + for (var i = 0; i < componentRootNodes.length; i++) { + dom_adapter_1.DOM.appendChild(hostElement, componentRootNodes[i]); + } + } + } + function projectMatchingNodes(selector, contentElement, nodes) { + var remaining = []; + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment('[')); + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + var matches = false; + if (isWildcard(selector)) { + matches = true; + } else if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.elementMatches(node, selector)) { + matches = true; + } + if (matches) { + dom_adapter_1.DOM.insertBefore(contentElement, node); + } else { + remaining.push(node); + } + } + dom_adapter_1.DOM.insertBefore(contentElement, dom_adapter_1.DOM.createComment(']')); + dom_adapter_1.DOM.remove(contentElement); + return remaining; + } + function isWildcard(selector) { + return lang_1.isBlank(selector) || selector.length === 0 || selector == '*'; + } + function sortContentElements(contentElements) { + var firstWildcard = null; + var sorted = []; + contentElements.forEach(function(contentElement) { + var select = dom_adapter_1.DOM.getAttribute(contentElement, 'select'); + if (isWildcard(select)) { + if (lang_1.isBlank(firstWildcard)) { + firstWildcard = contentElement; + } + } else { + sorted.push(contentElement); + } + }); + if (lang_1.isPresent(firstWildcard)) { + sorted.push(firstWildcard); + } + return sorted; + } + function createRootElementFromFragments(fragments) { + var rootElement = dom_adapter_1.DOM.createTemplate(''); + var rootNode = dom_adapter_1.DOM.content(rootElement); + for (var i = 0; i < fragments.length; i++) { + var fragment = fragments[i]; + if (i >= 1) { + dom_adapter_1.DOM.appendChild(rootNode, dom_adapter_1.DOM.createComment('|')); + } + fragment.forEach(function(node) { + dom_adapter_1.DOM.appendChild(rootNode, node); + }); + } + return rootElement; + } + function calcRootTextNodeIndices(rootNode, boundTextNodes, targetBoundTextIndices) { + var rootTextNodeIndices = []; + util_1.queryBoundTextNodeIndices(rootNode, boundTextNodes, function(textNode, nodeIndex, _) { + rootTextNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + return rootTextNodeIndices; + } + function calcElementBinders(clonedProtoViews, mergedBoundElements, elementsWithNativeShadowRoot, boundTextNodes, targetBoundTextIndices) { + var elementBinderByElement = indexElementBindersByElement(clonedProtoViews); + var mergedElementBinders = []; + for (var i = 0; i < mergedBoundElements.length; i++) { + var element = mergedBoundElements[i]; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(element, boundTextNodes, function(textNode, nodeIndex, _) { + textNodeIndices.push(nodeIndex); + targetBoundTextIndices.set(textNode, targetBoundTextIndices.size); + }); + mergedElementBinders.push(updateElementBinders(elementBinderByElement.get(element), textNodeIndices, collection_1.SetWrapper.has(elementsWithNativeShadowRoot, element))); + } + return mergedElementBinders; + } + function indexElementBindersByElement(mergableProtoViews) { + var elementBinderByElement = new Map(); + mergableProtoViews.forEach(function(mergableProtoView) { + for (var i = 0; i < mergableProtoView.boundElements.length; i++) { + var el = mergableProtoView.boundElements[i]; + if (lang_1.isPresent(el)) { + elementBinderByElement.set(el, mergableProtoView.original.elementBinders[i]); + } + } + }); + return elementBinderByElement; + } + function updateElementBinders(elementBinder, textNodeIndices, hasNativeShadowRoot) { + var result; + if (lang_1.isBlank(elementBinder)) { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: null, + localEvents: [], + globalEvents: [], + hasNativeShadowRoot: false + }); + } else { + result = new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: false, + eventLocals: elementBinder.eventLocals, + localEvents: elementBinder.localEvents, + globalEvents: elementBinder.globalEvents, + hasNativeShadowRoot: hasNativeShadowRoot + }); + } + return result; + } + function calcMappedElementIndices(clonedProtoViews, mergedBoundElements) { + var mergedBoundElementIndices = indexArray(mergedBoundElements); + var mappedElementIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundElements.forEach(function(boundElement) { + var mappedElementIndex = mergedBoundElementIndices.get(boundElement); + mappedElementIndices.push(mappedElementIndex); + }); + }); + return mappedElementIndices; + } + function calcMappedTextIndices(clonedProtoViews, mergedBoundTextIndices) { + var mappedTextIndices = []; + clonedProtoViews.forEach(function(clonedProtoView) { + clonedProtoView.boundTextNodes.forEach(function(textNode) { + var mappedTextIndex = mergedBoundTextIndices.get(textNode); + mappedTextIndices.push(mappedTextIndex); + }); + }); + return mappedTextIndices; + } + function calcHostElementIndicesByViewIndex(clonedProtoViews, hostViewAndBinderIndices) { + var hostElementIndices = [null]; + var viewElementOffsets = [0]; + var elementIndex = clonedProtoViews[0].original.elementBinders.length; + for (var viewIdx = 1; viewIdx < hostViewAndBinderIndices.length; viewIdx++) { + viewElementOffsets.push(elementIndex); + elementIndex += clonedProtoViews[viewIdx].original.elementBinders.length; + var hostViewIdx = hostViewAndBinderIndices[viewIdx][0]; + var hostBinderIdx = hostViewAndBinderIndices[viewIdx][1]; + hostElementIndices.push(viewElementOffsets[hostViewIdx] + hostBinderIdx); + } + return hostElementIndices; + } + function calcNestedViewCounts(hostViewAndBinderIndices) { + var nestedViewCounts = collection_1.ListWrapper.createFixedSize(hostViewAndBinderIndices.length); + collection_1.ListWrapper.fill(nestedViewCounts, 0); + for (var viewIdx = hostViewAndBinderIndices.length - 1; viewIdx >= 1; viewIdx--) { + var hostViewAndElementIdx = hostViewAndBinderIndices[viewIdx]; + if (lang_1.isPresent(hostViewAndElementIdx)) { + nestedViewCounts[hostViewAndElementIdx[0]] += nestedViewCounts[viewIdx] + 1; + } + } + return nestedViewCounts; + } + function indexArray(arr) { + var map = new Map(); + for (var i = 0; i < arr.length; i++) { + map.set(arr[i], i); + } + return map; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/template_cloner", ["angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/dom_tokens"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var TemplateCloner = (function() { + function TemplateCloner(maxInMemoryElementsPerTemplate) { + this.maxInMemoryElementsPerTemplate = maxInMemoryElementsPerTemplate; + } + TemplateCloner.prototype.prepareForClone = function(templateRoot) { + var elementCount = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(templateRoot), '*').length; + if (this.maxInMemoryElementsPerTemplate >= 0 && elementCount >= this.maxInMemoryElementsPerTemplate) { + return dom_adapter_1.DOM.getInnerHTML(templateRoot); + } else { + return templateRoot; + } + }; + TemplateCloner.prototype.cloneContent = function(preparedTemplateRoot, importNode) { + var templateContent; + if (lang_1.isString(preparedTemplateRoot)) { + templateContent = dom_adapter_1.DOM.content(dom_adapter_1.DOM.createTemplate(preparedTemplateRoot)); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } + } else { + templateContent = dom_adapter_1.DOM.content(preparedTemplateRoot); + if (importNode) { + templateContent = dom_adapter_1.DOM.importIntoDoc(templateContent); + } else { + templateContent = dom_adapter_1.DOM.clone(templateContent); + } + } + return templateContent; + }; + TemplateCloner = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE)), __metadata('design:paramtypes', [Object])], TemplateCloner); + return TemplateCloner; + })(); + exports.TemplateCloner = TemplateCloner; + 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/core/facade/math", ["angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + exports.Math = lang_1.global.Math; + exports.NaN = typeof exports.NaN; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/browser_details", ["angular2/src/core/di", "angular2/src/core/facade/math", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/math"); + var dom_adapter_1 = require("angular2/src/core/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/core/render/dom/events/event_manager", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/zone/ng_zone", "angular2/src/core/di"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var di_1 = require("angular2/src/core/di"); + exports.EVENT_MANAGER_PLUGINS = lang_1.CONST_EXPR(new di_1.OpaqueToken("EventManagerPlugins")); + var EventManager = (function() { + function EventManager(plugins, _zone) { + var _this = this; + this._zone = _zone; + plugins.forEach(function(p) { + return p.manager = _this; + }); + this._plugins = collection_1.ListWrapper.reversed(plugins); + } + EventManager.prototype.addEventListener = function(element, eventName, handler) { + var plugin = this._findPluginFor(eventName); + plugin.addEventListener(element, eventName, handler); + }; + EventManager.prototype.addGlobalEventListener = function(target, eventName, handler) { + var plugin = this._findPluginFor(eventName); + return plugin.addGlobalEventListener(target, eventName, handler); + }; + EventManager.prototype.getZone = function() { + return this._zone; + }; + EventManager.prototype._findPluginFor = function(eventName) { + var plugins = this._plugins; + for (var i = 0; i < plugins.length; i++) { + var plugin = plugins[i]; + if (plugin.supports(eventName)) { + return plugin; + } + } + throw new exceptions_1.BaseException("No event manager plugin found for event " + eventName); + }; + EventManager = __decorate([di_1.Injectable(), __param(0, di_1.Inject(exports.EVENT_MANAGER_PLUGINS)), __metadata('design:paramtypes', [Array, ng_zone_1.NgZone])], EventManager); + return EventManager; + })(); + exports.EventManager = EventManager; + var EventManagerPlugin = (function() { + function EventManagerPlugin() {} + EventManagerPlugin.prototype.supports = function(eventName) { + return false; + }; + EventManagerPlugin.prototype.addEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + EventManagerPlugin.prototype.addGlobalEventListener = function(element, eventName, handler) { + throw "not implemented"; + }; + return EventManagerPlugin; + })(); + exports.EventManagerPlugin = EventManagerPlugin; + var DomEventsPlugin = (function(_super) { + __extends(DomEventsPlugin, _super); + function DomEventsPlugin() { + _super.apply(this, arguments); + } + DomEventsPlugin.prototype.supports = function(eventName) { + return true; + }; + DomEventsPlugin.prototype.addEventListener = function(element, eventName, handler) { + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + this.manager.getZone().runOutsideAngular(function() { + dom_adapter_1.DOM.on(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin.prototype.addGlobalEventListener = function(target, eventName, handler) { + var element = dom_adapter_1.DOM.getGlobalEventTarget(target); + var zone = this.manager.getZone(); + var outsideHandler = function(event) { + return zone.run(function() { + return handler(event); + }); + }; + return this.manager.getZone().runOutsideAngular(function() { + return dom_adapter_1.DOM.onAndCancel(element, eventName, outsideHandler); + }); + }; + DomEventsPlugin = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], DomEventsPlugin); + return DomEventsPlugin; + })(EventManagerPlugin); + exports.DomEventsPlugin = DomEventsPlugin; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/view", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/render/api", "angular2/src/core/render/dom/util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + function resolveInternalDomView(viewRef) { + return viewRef._view; + } + exports.resolveInternalDomView = resolveInternalDomView; + var DomViewRef = (function(_super) { + __extends(DomViewRef, _super); + function DomViewRef(_view) { + _super.call(this); + this._view = _view; + } + return DomViewRef; + })(api_1.RenderViewRef); + exports.DomViewRef = DomViewRef; + var DomView = (function() { + function DomView(proto, boundTextNodes, boundElements) { + this.proto = proto; + this.boundTextNodes = boundTextNodes; + this.boundElements = boundElements; + this.hydrated = false; + this.eventDispatcher = null; + this.eventHandlerRemovers = []; + } + DomView.prototype.setElementProperty = function(elementIndex, propertyName, value) { + dom_adapter_1.DOM.setProperty(this.boundElements[elementIndex], propertyName, value); + }; + DomView.prototype.setElementAttribute = function(elementIndex, attributeName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedAttributeName = util_1.camelCaseToDashCase(attributeName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setAttribute(element, dashCasedAttributeName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeAttribute(element, dashCasedAttributeName); + } + }; + DomView.prototype.setElementClass = function(elementIndex, className, isAdd) { + var element = this.boundElements[elementIndex]; + if (isAdd) { + dom_adapter_1.DOM.addClass(element, className); + } else { + dom_adapter_1.DOM.removeClass(element, className); + } + }; + DomView.prototype.setElementStyle = function(elementIndex, styleName, value) { + var element = this.boundElements[elementIndex]; + var dashCasedStyleName = util_1.camelCaseToDashCase(styleName); + if (lang_1.isPresent(value)) { + dom_adapter_1.DOM.setStyle(element, dashCasedStyleName, lang_1.stringify(value)); + } else { + dom_adapter_1.DOM.removeStyle(element, dashCasedStyleName); + } + }; + DomView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + var element = this.boundElements[elementIndex]; + dom_adapter_1.DOM.invoke(element, methodName, args); + }; + DomView.prototype.setText = function(textIndex, value) { + dom_adapter_1.DOM.setText(this.boundTextNodes[textIndex], value); + }; + DomView.prototype.dispatchEvent = function(elementIndex, eventName, event) { + var allowDefaultBehavior = true; + if (lang_1.isPresent(this.eventDispatcher)) { + var evalLocals = new collection_1.Map(); + evalLocals.set('$event', event); + allowDefaultBehavior = this.eventDispatcher.dispatchRenderEvent(elementIndex, eventName, evalLocals); + if (!allowDefaultBehavior) { + dom_adapter_1.DOM.preventDefault(event); + } + } + return allowDefaultBehavior; + }; + return DomView; + })(); + exports.DomView = DomView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/fragment", ["angular2/src/core/render/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var api_1 = require("angular2/src/core/render/api"); + function resolveInternalDomFragment(fragmentRef) { + return fragmentRef._nodes; + } + exports.resolveInternalDomFragment = resolveInternalDomFragment; + var DomFragmentRef = (function(_super) { + __extends(DomFragmentRef, _super); + function DomFragmentRef(_nodes) { + _super.call(this); + this._nodes = _nodes; + } + return DomFragmentRef; + })(api_1.RenderFragmentRef); + exports.DomFragmentRef = DomFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render", ["angular2/src/core/render/render"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var render_1 = require("angular2/src/core/render/render"); + exports.RenderDirectiveMetadata = render_1.RenderDirectiveMetadata; + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + exports.ViewDefinition = render_1.ViewDefinition; + exports.DOCUMENT = render_1.DOCUMENT; + exports.APP_ID = render_1.APP_ID; + exports.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE = render_1.MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_for", ["angular2/src/core/metadata", "angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgFor = (function() { + function NgFor(_viewContainer, _templateRef, _iterableDiffers, _cdr) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._iterableDiffers = _iterableDiffers; + this._cdr = _cdr; + } + Object.defineProperty(NgFor.prototype, "ngForOf", { + set: function(value) { + this._ngForOf = value; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(value)) { + this._differ = this._iterableDiffers.find(value).create(this._cdr); + } + }, + enumerable: true, + configurable: true + }); + NgFor.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._ngForOf); + if (lang_1.isPresent(changes)) + this._applyChanges(changes); + } + }; + NgFor.prototype._applyChanges = function(changes) { + var recordViewTuples = []; + changes.forEachRemovedItem(function(removedRecord) { + return recordViewTuples.push(new RecordViewTuple(removedRecord, null)); + }); + changes.forEachMovedItem(function(movedRecord) { + return recordViewTuples.push(new RecordViewTuple(movedRecord, null)); + }); + var insertTuples = this._bulkRemove(recordViewTuples); + changes.forEachAddedItem(function(addedRecord) { + return insertTuples.push(new RecordViewTuple(addedRecord, null)); + }); + this._bulkInsert(insertTuples); + for (var i = 0; i < insertTuples.length; i++) { + this._perViewChange(insertTuples[i].view, insertTuples[i].record); + } + for (var i = 0, + ilen = this._viewContainer.length; i < ilen; i++) { + this._viewContainer.get(i).setLocal('last', i === ilen - 1); + } + }; + NgFor.prototype._perViewChange = function(view, record) { + view.setLocal('\$implicit', record.item); + view.setLocal('index', record.currentIndex); + view.setLocal('even', (record.currentIndex % 2 == 0)); + view.setLocal('odd', (record.currentIndex % 2 == 1)); + }; + NgFor.prototype._bulkRemove = function(tuples) { + tuples.sort(function(a, b) { + return a.record.previousIndex - b.record.previousIndex; + }); + var movedTuples = []; + for (var i = tuples.length - 1; i >= 0; i--) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.record.currentIndex)) { + tuple.view = this._viewContainer.detach(tuple.record.previousIndex); + movedTuples.push(tuple); + } else { + this._viewContainer.remove(tuple.record.previousIndex); + } + } + return movedTuples; + }; + NgFor.prototype._bulkInsert = function(tuples) { + tuples.sort(function(a, b) { + return a.record.currentIndex - b.record.currentIndex; + }); + for (var i = 0; i < tuples.length; i++) { + var tuple = tuples[i]; + if (lang_1.isPresent(tuple.view)) { + this._viewContainer.insert(tuple.view, tuple.record.currentIndex); + } else { + tuple.view = this._viewContainer.createEmbeddedView(this._templateRef, tuple.record.currentIndex); + } + } + return tuples; + }; + NgFor = __decorate([metadata_1.Directive({ + selector: '[ng-for][ng-for-of]', + properties: ['ngForOf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, change_detection_1.IterableDiffers, change_detection_1.ChangeDetectorRef])], NgFor); + return NgFor; + })(); + exports.NgFor = NgFor; + var RecordViewTuple = (function() { + function RecordViewTuple(record, view) { + this.record = record; + this.view = view; + } + return RecordViewTuple; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_if", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgIf = (function() { + function NgIf(_viewContainer, _templateRef) { + this._viewContainer = _viewContainer; + this._templateRef = _templateRef; + this._prevCondition = null; + } + Object.defineProperty(NgIf.prototype, "ngIf", { + set: function(newCondition) { + if (newCondition && (lang_1.isBlank(this._prevCondition) || !this._prevCondition)) { + this._prevCondition = true; + this._viewContainer.createEmbeddedView(this._templateRef); + } else if (!newCondition && (lang_1.isBlank(this._prevCondition) || this._prevCondition)) { + this._prevCondition = false; + this._viewContainer.clear(); + } + }, + enumerable: true, + configurable: true + }); + NgIf = __decorate([metadata_1.Directive({ + selector: '[ng-if]', + properties: ['ngIf'] + }), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef])], NgIf); + return NgIf; + })(); + exports.NgIf = NgIf; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_non_bindable", ["angular2/src/core/metadata"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var metadata_1 = require("angular2/src/core/metadata"); + var NgNonBindable = (function() { + function NgNonBindable() {} + NgNonBindable = __decorate([metadata_1.Directive({ + selector: '[ng-non-bindable]', + compileChildren: false + }), __metadata('design:paramtypes', [])], NgNonBindable); + return NgNonBindable; + })(); + exports.NgNonBindable = NgNonBindable; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_style", ["angular2/src/core/change_detection", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var change_detection_1 = require("angular2/src/core/change_detection"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var lang_1 = require("angular2/src/core/facade/lang"); + var NgStyle = (function() { + function NgStyle(_differs, _ngEl, _renderer) { + this._differs = _differs; + this._ngEl = _ngEl; + this._renderer = _renderer; + } + Object.defineProperty(NgStyle.prototype, "rawStyle", { + set: function(v) { + this._rawStyle = v; + if (lang_1.isBlank(this._differ) && lang_1.isPresent(v)) { + this._differ = this._differs.find(this._rawStyle).create(null); + } + }, + enumerable: true, + configurable: true + }); + NgStyle.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawStyle); + if (lang_1.isPresent(changes)) { + this._applyChanges(changes); + } + } + }; + NgStyle.prototype._applyChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._setStyle(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + _this._setStyle(record.key, null); + }); + }; + NgStyle.prototype._setStyle = function(name, val) { + this._renderer.setElementStyle(this._ngEl, name, val); + }; + NgStyle = __decorate([metadata_1.Directive({ + selector: '[ng-style]', + properties: ['rawStyle: ng-style'] + }), __metadata('design:paramtypes', [change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgStyle); + return NgStyle; + })(); + exports.NgStyle = NgStyle; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_switch", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/compiler", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var compiler_1 = require("angular2/src/core/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var _WHEN_DEFAULT = lang_1.CONST_EXPR(new Object()); + var SwitchView = (function() { + function SwitchView(_viewContainerRef, _templateRef) { + this._viewContainerRef = _viewContainerRef; + this._templateRef = _templateRef; + } + SwitchView.prototype.create = function() { + this._viewContainerRef.createEmbeddedView(this._templateRef); + }; + SwitchView.prototype.destroy = function() { + this._viewContainerRef.clear(); + }; + return SwitchView; + })(); + exports.SwitchView = SwitchView; + var NgSwitch = (function() { + function NgSwitch() { + this._useDefault = false; + this._valueViews = new collection_1.Map(); + this._activeViews = []; + } + Object.defineProperty(NgSwitch.prototype, "ngSwitch", { + set: function(value) { + this._emptyAllActiveViews(); + this._useDefault = false; + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + this._useDefault = true; + views = lang_1.normalizeBlank(this._valueViews.get(_WHEN_DEFAULT)); + } + this._activateViews(views); + this._switchValue = value; + }, + enumerable: true, + configurable: true + }); + NgSwitch.prototype._onWhenValueChanged = function(oldWhen, newWhen, view) { + this._deregisterView(oldWhen, view); + this._registerView(newWhen, view); + if (oldWhen === this._switchValue) { + view.destroy(); + collection_1.ListWrapper.remove(this._activeViews, view); + } else if (newWhen === this._switchValue) { + if (this._useDefault) { + this._useDefault = false; + this._emptyAllActiveViews(); + } + view.create(); + this._activeViews.push(view); + } + if (this._activeViews.length === 0 && !this._useDefault) { + this._useDefault = true; + this._activateViews(this._valueViews.get(_WHEN_DEFAULT)); + } + }; + NgSwitch.prototype._emptyAllActiveViews = function() { + var activeContainers = this._activeViews; + for (var i = 0; i < activeContainers.length; i++) { + activeContainers[i].destroy(); + } + this._activeViews = []; + }; + NgSwitch.prototype._activateViews = function(views) { + if (lang_1.isPresent(views)) { + for (var i = 0; i < views.length; i++) { + views[i].create(); + } + this._activeViews = views; + } + }; + NgSwitch.prototype._registerView = function(value, view) { + var views = this._valueViews.get(value); + if (lang_1.isBlank(views)) { + views = []; + this._valueViews.set(value, views); + } + views.push(view); + }; + NgSwitch.prototype._deregisterView = function(value, view) { + if (value === _WHEN_DEFAULT) + return ; + var views = this._valueViews.get(value); + if (views.length == 1) { + this._valueViews.delete(value); + } else { + collection_1.ListWrapper.remove(views, view); + } + }; + NgSwitch = __decorate([metadata_1.Directive({ + selector: '[ng-switch]', + properties: ['ngSwitch'] + }), __metadata('design:paramtypes', [])], NgSwitch); + return NgSwitch; + })(); + exports.NgSwitch = NgSwitch; + var NgSwitchWhen = (function() { + function NgSwitchWhen(viewContainer, templateRef, _switch) { + this._switch = _switch; + this._value = _WHEN_DEFAULT; + this._view = new SwitchView(viewContainer, templateRef); + } + Object.defineProperty(NgSwitchWhen.prototype, "ngSwitchWhen", { + set: function(value) { + this._switch._onWhenValueChanged(this._value, value, this._view); + this._value = value; + }, + enumerable: true, + configurable: true + }); + NgSwitchWhen = __decorate([metadata_1.Directive({ + selector: '[ng-switch-when]', + properties: ['ngSwitchWhen'] + }), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchWhen); + return NgSwitchWhen; + })(); + exports.NgSwitchWhen = NgSwitchWhen; + var NgSwitchDefault = (function() { + function NgSwitchDefault(viewContainer, templateRef, sswitch) { + sswitch._registerView(_WHEN_DEFAULT, new SwitchView(viewContainer, templateRef)); + } + NgSwitchDefault = __decorate([metadata_1.Directive({selector: '[ng-switch-default]'}), __param(2, di_1.Host()), __metadata('design:paramtypes', [compiler_1.ViewContainerRef, compiler_1.TemplateRef, NgSwitch])], NgSwitchDefault); + return NgSwitchDefault; + })(); + exports.NgSwitchDefault = NgSwitchDefault; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/observable_list_diff", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/validators", ["angular2/src/core/facade/lang", "angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var lang_2 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + exports.NG_VALIDATORS = lang_2.CONST_EXPR(new di_1.OpaqueToken("NgValidators")); + var Validators = (function() { + function Validators() {} + Validators.required = function(control) { + return lang_1.isBlank(control.value) || control.value == "" ? {"required": true} : null; + }; + Validators.nullValidator = function(c) { + return null; + }; + Validators.compose = function(validators) { + if (lang_1.isBlank(validators)) + return Validators.nullValidator; + return function(control) { + var res = collection_1.ListWrapper.reduce(validators, function(res, validator) { + var errors = validator(control); + return lang_1.isPresent(errors) ? collection_1.StringMapWrapper.merge(res, errors) : res; + }, {}); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + }; + Validators.group = function(group) { + var res = {}; + collection_1.StringMapWrapper.forEach(group.controls, function(control, name) { + if (group.contains(name) && lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators.array = function(array) { + var res = {}; + array.controls.forEach(function(control) { + if (lang_1.isPresent(control.errors)) { + Validators._mergeErrors(control, res); + } + }); + return collection_1.StringMapWrapper.isEmpty(res) ? null : res; + }; + Validators._mergeErrors = function(control, res) { + collection_1.StringMapWrapper.forEach(control.errors, function(value, error) { + if (!collection_1.StringMapWrapper.contains(res, error)) { + res[error] = []; + } + var current = res[error]; + current.push(control); + }); + }; + return Validators; + })(); + exports.Validators = Validators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/abstract_control_directive", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var AbstractControlDirective = (function() { + function AbstractControlDirective() {} + Object.defineProperty(AbstractControlDirective.prototype, "control", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "value", { + get: function() { + return this.control.value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "valid", { + get: function() { + return this.control.valid; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "errors", { + get: function() { + return this.control.errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "pristine", { + get: function() { + return this.control.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "dirty", { + get: function() { + return this.control.dirty; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "touched", { + get: function() { + return this.control.touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControlDirective.prototype, "untouched", { + get: function() { + return this.control.untouched; + }, + enumerable: true, + configurable: true + }); + return AbstractControlDirective; + })(); + exports.AbstractControlDirective = AbstractControlDirective; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/control_container", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var ControlContainer = (function(_super) { + __extends(ControlContainer, _super); + function ControlContainer() { + _super.apply(this, arguments); + } + Object.defineProperty(ControlContainer.prototype, "formDirective", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ControlContainer.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + return ControlContainer; + })(abstract_control_directive_1.AbstractControlDirective); + exports.ControlContainer = ControlContainer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control", ["angular2/src/core/forms/directives/abstract_control_directive"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + var NgControl = (function(_super) { + __extends(NgControl, _super); + function NgControl() { + _super.apply(this, arguments); + this.name = null; + this.valueAccessor = null; + } + Object.defineProperty(NgControl.prototype, "validator", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControl.prototype, "path", { + get: function() { + return null; + }, + enumerable: true, + configurable: true + }); + NgControl.prototype.viewToModelUpdate = function(newValue) {}; + return NgControl; + })(abstract_control_directive_1.AbstractControlDirective); + exports.NgControl = NgControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/shared", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/forms/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var validators_1 = require("angular2/src/core/forms/validators"); + function controlPath(name, parent) { + var p = collection_1.ListWrapper.clone(parent.path); + p.push(name); + return p; + } + exports.controlPath = controlPath; + function setUpControl(control, dir) { + if (lang_1.isBlank(control)) + _throwError(dir, "Cannot find control"); + if (lang_1.isBlank(dir.valueAccessor)) + _throwError(dir, "No value accessor for"); + control.validator = validators_1.Validators.compose([control.validator, dir.validator]); + dir.valueAccessor.writeValue(control.value); + dir.valueAccessor.registerOnChange(function(newValue) { + dir.viewToModelUpdate(newValue); + control.updateValue(newValue, {emitModelToViewChange: false}); + control.markAsDirty(); + }); + control.registerOnChange(function(newValue) { + return dir.valueAccessor.writeValue(newValue); + }); + dir.valueAccessor.registerOnTouched(function() { + return control.markAsTouched(); + }); + } + exports.setUpControl = setUpControl; + function _throwError(dir, message) { + var path = collection_1.ListWrapper.join(dir.path, " -> "); + throw new exceptions_1.BaseException(message + " '" + path + "'"); + } + function setProperty(renderer, elementRef, propName, propValue) { + renderer.setElementProperty(elementRef, propName, propValue); + } + exports.setProperty = setProperty; + function isPropertyUpdated(changes, viewModel) { + if (!collection_1.StringMapWrapper.contains(changes, "model")) + return false; + var change = changes["model"]; + if (change.isFirstChange()) + return true; + return !lang_1.looseIdentical(viewModel, change.currentValue); + } + exports.isPropertyUpdated = isPropertyUpdated; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_control", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgFormControl; + })})); + var NgFormControl = (function(_super) { + __extends(NgFormControl, _super); + function NgFormControl(validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this.validators = validators; + } + NgFormControl.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this.form, this); + this.form.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.form.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgFormControl.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormControl.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgFormControl.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgFormControl = __decorate([metadata_1.Directive({ + selector: '[ng-form-control]', + bindings: [formControlBinding], + properties: ['form: ngFormControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgFormControl); + return NgFormControl; + })(ng_control_1.NgControl); + exports.NgFormControl = NgFormControl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/model", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var model_1 = require("angular2/src/core/forms/model"); + var validators_1 = require("angular2/src/core/forms/validators"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formControlBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgModel; + })})); + var NgModel = (function(_super) { + __extends(NgModel, _super); + function NgModel(validators) { + _super.call(this); + this._control = new model_1.Control(); + this._added = false; + this.update = new async_1.EventEmitter(); + this.validators = validators; + } + NgModel.prototype.onChanges = function(changes) { + if (!this._added) { + shared_1.setUpControl(this._control, this); + this._control.updateValidity(); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this._control.updateValue(this.model); + this.viewModel = this.model; + } + }; + Object.defineProperty(NgModel.prototype, "control", { + get: function() { + return this._control; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgModel.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgModel.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + NgModel = __decorate([metadata_1.Directive({ + selector: '[ng-model]:not([ng-control]):not([ng-form-control])', + bindings: [formControlBinding], + properties: ['model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Optional()), __param(0, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [Array])], NgModel); + return NgModel; + })(ng_control_1.NgControl); + exports.NgModel = NgModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_group", ["angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var lang_1 = require("angular2/src/core/facade/lang"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var controlGroupBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgControlGroup; + })})); + var NgControlGroup = (function(_super) { + __extends(NgControlGroup, _super); + function NgControlGroup(_parent) { + _super.call(this); + this._parent = _parent; + } + NgControlGroup.prototype.onInit = function() { + this.formDirective.addControlGroup(this); + }; + NgControlGroup.prototype.onDestroy = function() { + this.formDirective.removeControlGroup(this); + }; + Object.defineProperty(NgControlGroup.prototype, "control", { + get: function() { + return this.formDirective.getControlGroup(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlGroup.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + NgControlGroup = __decorate([metadata_1.Directive({ + selector: '[ng-control-group]', + bindings: [controlGroupBinding], + properties: ['name: ng-control-group'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __metadata('design:paramtypes', [control_container_1.ControlContainer])], NgControlGroup); + return NgControlGroup; + })(control_container_1.ControlContainer); + exports.NgControlGroup = NgControlGroup; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form_model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgFormModel; + })})); + var NgFormModel = (function(_super) { + __extends(NgFormModel, _super); + function NgFormModel() { + _super.apply(this, arguments); + this.form = null; + this.directives = []; + this.ngSubmit = new async_1.EventEmitter(); + } + NgFormModel.prototype.onChanges = function(_) { + this._updateDomValue(); + }; + Object.defineProperty(NgFormModel.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgFormModel.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + NgFormModel.prototype.addControl = function(dir) { + var ctrl = this.form.find(dir.path); + shared_1.setUpControl(ctrl, dir); + ctrl.updateValidity(); + this.directives.push(dir); + }; + NgFormModel.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.removeControl = function(dir) { + collection_1.ListWrapper.remove(this.directives, dir); + }; + NgFormModel.prototype.addControlGroup = function(dir) {}; + NgFormModel.prototype.removeControlGroup = function(dir) {}; + NgFormModel.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgFormModel.prototype.updateModel = function(dir, value) { + var ctrl = this.form.find(dir.path); + ctrl.updateValue(value); + }; + NgFormModel.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgFormModel.prototype._updateDomValue = function() { + var _this = this; + collection_1.ListWrapper.forEach(this.directives, function(dir) { + var ctrl = _this.form.find(dir.path); + dir.valueAccessor.writeValue(ctrl.value); + }); + }; + NgFormModel = __decorate([metadata_1.Directive({ + selector: '[ng-form-model]', + bindings: [formDirectiveBinding], + properties: ['form: ng-form-model'], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgFormModel); + return NgFormModel; + })(control_container_1.ControlContainer); + exports.NgFormModel = NgFormModel; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_form", ["angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/model", "angular2/src/core/forms/directives/shared"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var model_1 = require("angular2/src/core/forms/model"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var formDirectiveBinding = lang_1.CONST_EXPR(new di_1.Binding(control_container_1.ControlContainer, {toAlias: di_1.forwardRef(function() { + return NgForm; + })})); + var NgForm = (function(_super) { + __extends(NgForm, _super); + function NgForm() { + _super.apply(this, arguments); + this.form = new model_1.ControlGroup({}); + this.ngSubmit = new async_1.EventEmitter(); + } + Object.defineProperty(NgForm.prototype, "formDirective", { + get: function() { + return this; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "control", { + get: function() { + return this.form; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "path", { + get: function() { + return []; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgForm.prototype, "controls", { + get: function() { + return this.form.controls; + }, + enumerable: true, + configurable: true + }); + NgForm.prototype.addControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var ctrl = new model_1.Control(); + shared_1.setUpControl(ctrl, dir); + container.addControl(dir.name, ctrl); + ctrl.updateValidity(); + }); + }; + NgForm.prototype.getControl = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.removeControl = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.addControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + var group = new model_1.ControlGroup({}); + container.addControl(dir.name, group); + group.updateValidity(); + }); + }; + NgForm.prototype.removeControlGroup = function(dir) { + var _this = this; + this._later(function(_) { + var container = _this._findContainer(dir.path); + if (lang_1.isPresent(container)) { + container.removeControl(dir.name); + container.updateValidity(); + } + }); + }; + NgForm.prototype.getControlGroup = function(dir) { + return this.form.find(dir.path); + }; + NgForm.prototype.updateModel = function(dir, value) { + var _this = this; + this._later(function(_) { + var ctrl = _this.form.find(dir.path); + ctrl.updateValue(value); + }); + }; + NgForm.prototype.onSubmit = function() { + async_1.ObservableWrapper.callNext(this.ngSubmit, null); + return false; + }; + NgForm.prototype._findContainer = function(path) { + collection_1.ListWrapper.removeLast(path); + return collection_1.ListWrapper.isEmpty(path) ? this.form : this.form.find(path); + }; + NgForm.prototype._later = function(fn) { + async_1.PromiseWrapper.then(async_1.PromiseWrapper.resolve(null), fn, function(_) {}); + }; + NgForm = __decorate([metadata_1.Directive({ + selector: 'form:not([ng-no-form]):not([ng-form-model]),ng-form,[ng-form]', + bindings: [formDirectiveBinding], + host: {'(submit)': 'onSubmit()'}, + events: ['ngSubmit'], + exportAs: 'form' + }), __metadata('design:paramtypes', [])], NgForm); + return NgForm; + })(control_container_1.ControlContainer); + exports.NgForm = NgForm; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/default_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/render", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var render_1 = require("angular2/src/core/render"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var DefaultValueAccessor = (function() { + function DefaultValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + DefaultValueAccessor.prototype.writeValue = function(value) { + var normalizedValue = lang_1.isBlank(value) ? '' : value; + shared_1.setProperty(this._renderer, this._elementRef, 'value', normalizedValue); + }; + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DefaultValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + DefaultValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + DefaultValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + DefaultValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input:not([type=checkbox])[ng-control],textarea[ng-control],input:not([type=checkbox])[ng-form-control],textarea[ng-form-control],input:not([type=checkbox])[ng-model],textarea[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], DefaultValueAccessor); + return DefaultValueAccessor; + })(); + exports.DefaultValueAccessor = DefaultValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/checkbox_value_accessor", ["angular2/src/core/metadata", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/di", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var metadata_1 = require("angular2/src/core/metadata"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var di_1 = require("angular2/src/core/di"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var CheckboxControlValueAccessor = (function() { + function CheckboxControlValueAccessor(cd, _renderer, _elementRef) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + } + CheckboxControlValueAccessor.prototype.writeValue = function(value) { + shared_1.setProperty(this._renderer, this._elementRef, "checked", value); + }; + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(CheckboxControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + CheckboxControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + CheckboxControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + CheckboxControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'input[type=checkbox][ng-control],input[type=checkbox][ng-form-control],input[type=checkbox][ng-model]', + host: { + '(change)': 'onChange($event.target.checked)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef])], CheckboxControlValueAccessor); + return CheckboxControlValueAccessor; + })(); + exports.CheckboxControlValueAccessor = CheckboxControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/select_control_value_accessor", ["angular2/src/core/di", "angular2/src/core/render", "angular2/src/core/compiler", "angular2/src/core/metadata", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/facade/lang", "angular2/src/core/forms/directives/shared"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var render_1 = require("angular2/src/core/render"); + var compiler_1 = require("angular2/src/core/compiler"); + var metadata_1 = require("angular2/src/core/metadata"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var lang_1 = require("angular2/src/core/facade/lang"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var NgSelectOption = (function() { + function NgSelectOption() {} + NgSelectOption = __decorate([metadata_1.Directive({selector: 'option'}), __metadata('design:paramtypes', [])], NgSelectOption); + return NgSelectOption; + })(); + exports.NgSelectOption = NgSelectOption; + var SelectControlValueAccessor = (function() { + function SelectControlValueAccessor(cd, _renderer, _elementRef, query) { + this._renderer = _renderer; + this._elementRef = _elementRef; + this.onChange = function(_) {}; + this.onTouched = function() {}; + this._cd = cd; + cd.valueAccessor = this; + this._updateValueWhenListOfOptionsChanges(query); + } + SelectControlValueAccessor.prototype.writeValue = function(value) { + this.value = value; + shared_1.setProperty(this._renderer, this._elementRef, "value", value); + }; + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassUntouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.untouched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassTouched", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.touched : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassPristine", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.pristine : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassDirty", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.dirty : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassValid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(SelectControlValueAccessor.prototype, "ngClassInvalid", { + get: function() { + return lang_1.isPresent(this._cd.control) ? !this._cd.control.valid : false; + }, + enumerable: true, + configurable: true + }); + SelectControlValueAccessor.prototype.registerOnChange = function(fn) { + this.onChange = fn; + }; + SelectControlValueAccessor.prototype.registerOnTouched = function(fn) { + this.onTouched = fn; + }; + SelectControlValueAccessor.prototype._updateValueWhenListOfOptionsChanges = function(query) { + var _this = this; + query.onChange(function() { + return _this.writeValue(_this.value); + }); + }; + SelectControlValueAccessor = __decorate([metadata_1.Directive({ + selector: 'select[ng-control],select[ng-form-control],select[ng-model]', + host: { + '(change)': 'onChange($event.target.value)', + '(input)': 'onChange($event.target.value)', + '(blur)': 'onTouched()', + '[class.ng-untouched]': 'ngClassUntouched', + '[class.ng-touched]': 'ngClassTouched', + '[class.ng-pristine]': 'ngClassPristine', + '[class.ng-dirty]': 'ngClassDirty', + '[class.ng-valid]': 'ngClassValid', + '[class.ng-invalid]': 'ngClassInvalid' + } + }), __param(0, di_1.Self()), __param(3, metadata_1.Query(NgSelectOption, {descendants: true})), __metadata('design:paramtypes', [ng_control_1.NgControl, render_1.Renderer, compiler_1.ElementRef, compiler_1.QueryList])], SelectControlValueAccessor); + return SelectControlValueAccessor; + })(); + exports.SelectControlValueAccessor = SelectControlValueAccessor; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/validators", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/forms/validators"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var validators_1 = require("angular2/src/core/forms/validators"); + var DEFAULT_VALIDATORS = lang_1.CONST_EXPR(new di_1.Binding(validators_1.NG_VALIDATORS, { + toValue: validators_1.Validators.required, + multi: true + })); + var DefaultValidators = (function() { + function DefaultValidators() {} + DefaultValidators = __decorate([metadata_1.Directive({ + selector: '[required][ng-control],[required][ng-form-control],[required][ng-model]', + bindings: [DEFAULT_VALIDATORS] + }), __metadata('design:paramtypes', [])], DefaultValidators); + return DefaultValidators; + })(); + exports.DefaultValidators = DefaultValidators; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/form_builder", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/forms/model"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var modelModule = require("angular2/src/core/forms/model"); + var FormBuilder = (function() { + function FormBuilder() {} + FormBuilder.prototype.group = function(controlsConfig, extra) { + if (extra === void 0) { + extra = null; + } + var controls = this._reduceControls(controlsConfig); + var optionals = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "optionals") : null; + var validator = lang_1.isPresent(extra) ? collection_1.StringMapWrapper.get(extra, "validator") : null; + if (lang_1.isPresent(validator)) { + return new modelModule.ControlGroup(controls, optionals, validator); + } else { + return new modelModule.ControlGroup(controls, optionals); + } + }; + FormBuilder.prototype.control = function(value, validator) { + if (validator === void 0) { + validator = null; + } + if (lang_1.isPresent(validator)) { + return new modelModule.Control(value, validator); + } else { + return new modelModule.Control(value); + } + }; + FormBuilder.prototype.array = function(controlsConfig, validator) { + var _this = this; + if (validator === void 0) { + validator = null; + } + var controls = collection_1.ListWrapper.map(controlsConfig, function(c) { + return _this._createControl(c); + }); + if (lang_1.isPresent(validator)) { + return new modelModule.ControlArray(controls, validator); + } else { + return new modelModule.ControlArray(controls); + } + }; + FormBuilder.prototype._reduceControls = function(controlsConfig) { + var _this = this; + var controls = {}; + collection_1.StringMapWrapper.forEach(controlsConfig, function(controlConfig, controlName) { + controls[controlName] = _this._createControl(controlConfig); + }); + return controls; + }; + FormBuilder.prototype._createControl = function(controlConfig) { + if (controlConfig instanceof modelModule.Control || controlConfig instanceof modelModule.ControlGroup || controlConfig instanceof modelModule.ControlArray) { + return controlConfig; + } else if (lang_1.isArray(controlConfig)) { + var value = controlConfig[0]; + var validator = controlConfig.length > 1 ? controlConfig[1] : null; + return this.control(value, validator); + } else { + return this.control(controlConfig); + } + }; + FormBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], FormBuilder); + return FormBuilder; + })(); + exports.FormBuilder = FormBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var DebugElement = (function() { + function DebugElement(_parentView, _boundElementIndex) { + this._parentView = _parentView; + this._boundElementIndex = _boundElementIndex; + this._elementInjector = this._parentView.elementInjectors[this._boundElementIndex]; + } + Object.defineProperty(DebugElement.prototype, "componentInstance", { + get: function() { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.getComponent(); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "nativeElement", { + get: function() { + return this.elementRef.nativeElement; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "elementRef", { + get: function() { + return this._parentView.elementRefs[this._boundElementIndex]; + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.getDirectiveInstance = function(directiveIndex) { + return this._elementInjector.getDirectiveAtIndex(directiveIndex); + }; + Object.defineProperty(DebugElement.prototype, "children", { + get: function() { + return this._getChildElements(this._parentView, this._boundElementIndex); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DebugElement.prototype, "componentViewChildren", { + get: function() { + var shadowView = this._parentView.getNestedView(this._boundElementIndex); + if (!lang_1.isPresent(shadowView)) { + return []; + } + return this._getChildElements(shadowView, null); + }, + enumerable: true, + configurable: true + }); + DebugElement.prototype.triggerEventHandler = function(eventName, eventObj) { + this._parentView.triggerEventHandlers(eventName, eventObj, this._boundElementIndex); + }; + DebugElement.prototype.hasDirective = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return false; + } + return this._elementInjector.hasDirective(type); + }; + DebugElement.prototype.inject = function(type) { + if (!lang_1.isPresent(this._elementInjector)) { + return null; + } + return this._elementInjector.get(type); + }; + DebugElement.prototype.getLocal = function(name) { + return this._parentView.locals.get(name); + }; + DebugElement.prototype.query = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var results = this.queryAll(predicate, scope); + return results.length > 0 ? results[0] : null; + }; + DebugElement.prototype.queryAll = function(predicate, scope) { + if (scope === void 0) { + scope = Scope.all; + } + var elementsInScope = scope(this); + return collection_1.ListWrapper.filter(elementsInScope, predicate); + }; + DebugElement.prototype._getChildElements = function(view, parentBoundElementIndex) { + var _this = this; + var els = []; + var parentElementBinder = null; + if (lang_1.isPresent(parentBoundElementIndex)) { + parentElementBinder = view.proto.elementBinders[parentBoundElementIndex - view.elementOffset]; + } + for (var i = 0; i < view.proto.elementBinders.length; ++i) { + var binder = view.proto.elementBinders[i]; + if (binder.parent == parentElementBinder) { + els.push(new DebugElement(view, view.elementOffset + i)); + var views = view.viewContainers[view.elementOffset + i]; + if (lang_1.isPresent(views)) { + collection_1.ListWrapper.forEach(views.views, function(nextView) { + els = els.concat(_this._getChildElements(nextView, null)); + }); + } + } + } + return els; + }; + return DebugElement; + })(); + exports.DebugElement = DebugElement; + function inspectElement(elementRef) { + return new DebugElement(view_ref_1.internalView(elementRef.parentView), elementRef.boundElementIndex); + } + exports.inspectElement = inspectElement; + function asNativeElements(arr) { + return arr.map(function(debugEl) { + return debugEl.nativeElement; + }); + } + exports.asNativeElements = asNativeElements; + var Scope = (function() { + function Scope() {} + Scope.all = function(debugElement) { + var scope = []; + scope.push(debugElement); + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope = scope.concat(Scope.all(child)); + }); + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope = scope.concat(Scope.all(child)); + }); + return scope; + }; + Scope.light = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.children, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + Scope.view = function(debugElement) { + var scope = []; + collection_1.ListWrapper.forEach(debugElement.componentViewChildren, function(child) { + scope.push(child); + scope = scope.concat(Scope.light(child)); + }); + return scope; + }; + return Scope; + })(); + exports.Scope = Scope; + var By = (function() { + function By() {} + By.all = function() { + return function(debugElement) { + return true; + }; + }; + By.css = function(selector) { + return function(debugElement) { + return lang_1.isPresent(debugElement.nativeElement) ? dom_adapter_1.DOM.elementMatches(debugElement.nativeElement, selector) : false; + }; + }; + By.directive = function(type) { + return function(debugElement) { + return debugElement.hasDirective(type); + }; + }; + return By; + })(); + exports.By = By; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug/debug_element_view_listener", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/compiler/view_listener", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/debug/debug_element"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var debug_element_1 = require("angular2/src/core/debug/debug_element"); + var NG_ID_PROPERTY = 'ngid'; + var INSPECT_GLOBAL_NAME = 'ng.probe'; + var NG_ID_SEPARATOR = '#'; + var _allIdsByView = new collection_1.Map(); + var _allViewsById = new collection_1.Map(); + var _nextId = 0; + function _setElementId(element, indices) { + if (lang_1.isPresent(element)) { + dom_adapter_1.DOM.setData(element, NG_ID_PROPERTY, collection_1.ListWrapper.join(indices, NG_ID_SEPARATOR)); + } + } + function _getElementId(element) { + var elId = dom_adapter_1.DOM.getData(element, NG_ID_PROPERTY); + if (lang_1.isPresent(elId)) { + return collection_1.ListWrapper.map(elId.split(NG_ID_SEPARATOR), function(partStr) { + return lang_1.NumberWrapper.parseInt(partStr, 10); + }); + } else { + return null; + } + } + function inspectNativeElement(element) { + var elId = _getElementId(element); + if (lang_1.isPresent(elId)) { + var view = _allViewsById.get(elId[0]); + if (lang_1.isPresent(view)) { + return new debug_element_1.DebugElement(view, elId[1]); + } + } + return null; + } + exports.inspectNativeElement = inspectNativeElement; + var DebugElementViewListener = (function() { + function DebugElementViewListener(_renderer) { + this._renderer = _renderer; + dom_adapter_1.DOM.setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); + } + DebugElementViewListener.prototype.viewCreated = function(view) { + var viewId = _nextId++; + _allViewsById.set(viewId, view); + _allIdsByView.set(view, viewId); + for (var i = 0; i < view.elementRefs.length; i++) { + var el = view.elementRefs[i]; + _setElementId(this._renderer.getNativeElementSync(el), [viewId, i]); + } + }; + DebugElementViewListener.prototype.viewDestroyed = function(view) { + var viewId = _allIdsByView.get(view); + collection_1.MapWrapper.delete(_allIdsByView, view); + collection_1.MapWrapper.delete(_allViewsById, viewId); + }; + DebugElementViewListener = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [api_1.Renderer])], DebugElementViewListener); + return DebugElementViewListener; + })(); + exports.DebugElementViewListener = DebugElementViewListener; + exports.ELEMENT_PROBE_BINDINGS = lang_1.CONST_EXPR([DebugElementViewListener, lang_1.CONST_EXPR(new di_1.Binding(view_listener_1.AppViewListener, {toAlias: DebugElementViewListener}))]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/profile", ["angular2/src/core/profile/profile"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var profile_1 = require("angular2/src/core/profile/profile"); + exports.wtfCreateScope = profile_1.wtfCreateScope; + exports.wtfLeave = profile_1.wtfLeave; + exports.wtfStartTimeRange = profile_1.wtfStartTimeRange; + exports.wtfEndTimeRange = profile_1.wtfEndTimeRange; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/post_message_bus", ["angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var PostMessageBus = (function() { + function PostMessageBus(sink, source) { + this.sink = sink; + this.source = source; + } + PostMessageBus.prototype.attachToZone = function(zone) { + this.source.attachToZone(zone); + this.sink.attachToZone(zone); + }; + PostMessageBus.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this.source.initChannel(channel, runInZone); + this.sink.initChannel(channel, runInZone); + }; + PostMessageBus.prototype.from = function(channel) { + return this.source.from(channel); + }; + PostMessageBus.prototype.to = function(channel) { + return this.sink.to(channel); + }; + PostMessageBus = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [PostMessageBusSink, PostMessageBusSource])], PostMessageBus); + return PostMessageBus; + })(); + exports.PostMessageBus = PostMessageBus; + var PostMessageBusSink = (function() { + function PostMessageBusSink(_postMessageTarget) { + this._postMessageTarget = _postMessageTarget; + this._channels = collection_1.StringMapWrapper.create(); + this._messageBuffer = []; + } + PostMessageBusSink.prototype.attachToZone = function(zone) { + var _this = this; + this._zone = zone; + this._zone.overrideOnEventDone(function() { + return _this._handleOnEventDone(); + }, false); + }; + PostMessageBusSink.prototype.initChannel = function(channel, runInZone) { + var _this = this; + if (runInZone === void 0) { + runInZone = true; + } + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + throw new exceptions_1.BaseException(channel + " has already been initialized"); + } + var emitter = new async_1.EventEmitter(); + var channelInfo = new _Channel(emitter, runInZone); + this._channels[channel] = channelInfo; + emitter.observer({next: function(data) { + var message = { + channel: channel, + message: data + }; + if (runInZone) { + _this._messageBuffer.push(message); + } else { + _this._sendMessages([message]); + } + }}); + }; + PostMessageBusSink.prototype.to = function(channel) { + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + return this._channels[channel].emitter; + } else { + throw new exceptions_1.BaseException(channel + " is not set up. Did you forget to call initChannel?"); + } + }; + PostMessageBusSink.prototype._handleOnEventDone = function() { + this._sendMessages(this._messageBuffer); + this._messageBuffer = []; + }; + PostMessageBusSink.prototype._sendMessages = function(messages) { + this._postMessageTarget.postMessage(messages); + }; + return PostMessageBusSink; + })(); + exports.PostMessageBusSink = PostMessageBusSink; + var PostMessageBusSource = (function() { + function PostMessageBusSource(eventTarget) { + var _this = this; + this._channels = collection_1.StringMapWrapper.create(); + if (eventTarget) { + eventTarget.addEventListener("message", function(ev) { + return _this._handleMessages(ev); + }); + } else { + addEventListener("message", function(ev) { + return _this._handleMessages(ev); + }); + } + } + PostMessageBusSource.prototype.attachToZone = function(zone) { + this._zone = zone; + }; + PostMessageBusSource.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + throw new exceptions_1.BaseException(channel + " has already been initialized"); + } + var emitter = new async_1.EventEmitter(); + var channelInfo = new _Channel(emitter, runInZone); + this._channels[channel] = channelInfo; + }; + PostMessageBusSource.prototype.from = function(channel) { + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + return this._channels[channel].emitter; + } else { + throw new exceptions_1.BaseException(channel + " is not set up. Did you forget to call initChannel?"); + } + }; + PostMessageBusSource.prototype._handleMessages = function(ev) { + var messages = ev.data; + for (var i = 0; i < messages.length; i++) { + this._handleMessage(messages[i]); + } + }; + PostMessageBusSource.prototype._handleMessage = function(data) { + var channel = data.channel; + if (collection_1.StringMapWrapper.contains(this._channels, channel)) { + var channelInfo = this._channels[channel]; + if (channelInfo.runInZone) { + this._zone.run(function() { + channelInfo.emitter.next(data.message); + }); + } else { + channelInfo.emitter.next(data.message); + } + } + }; + return PostMessageBusSource; + })(); + exports.PostMessageBusSource = PostMessageBusSource; + var _Channel = (function() { + function _Channel(emitter, runInZone) { + this.emitter = emitter; + this.runInZone = runInZone; + } + return _Channel; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/message_bus", ["angular2/src/core/facade/exceptions", "angular2/src/core/facade/async"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + exports.EventEmitter = async_1.EventEmitter; + exports.Observable = async_1.Observable; + function _abstract() { + throw new exceptions_1.BaseException("This method is abstract"); + } + var MessageBus = (function() { + function MessageBus() {} + MessageBus.prototype.initChannel = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + throw _abstract(); + }; + MessageBus.prototype.attachToZone = function(zone) { + throw _abstract(); + }; + MessageBus.prototype.from = function(channel) { + throw _abstract(); + }; + MessageBus.prototype.to = function(channel) { + throw _abstract(); + }; + return MessageBus; + })(); + exports.MessageBus = MessageBus; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/api", ["angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + exports.ON_WEB_WORKER = lang_1.CONST_EXPR(new di_1.OpaqueToken('WebWorker.onWebWorker')); + var WebWorkerElementRef = (function() { + function WebWorkerElementRef(renderView, renderBoundElementIndex) { + this.renderView = renderView; + this.renderBoundElementIndex = renderBoundElementIndex; + } + return WebWorkerElementRef; + })(); + exports.WebWorkerElementRef = WebWorkerElementRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_proto_view_ref_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var RenderProtoViewRefStore = (function() { + function RenderProtoViewRefStore(onWebworker) { + this._lookupByIndex = new Map(); + this._lookupByProtoView = new Map(); + this._nextIndex = 0; + this._onWebworker = onWebworker; + } + RenderProtoViewRefStore.prototype.storeRenderProtoViewRef = function(ref) { + if (this._lookupByProtoView.has(ref)) { + return this._lookupByProtoView.get(ref); + } else { + this._lookupByIndex.set(this._nextIndex, ref); + this._lookupByProtoView.set(ref, this._nextIndex); + return this._nextIndex++; + } + }; + RenderProtoViewRefStore.prototype.retreiveRenderProtoViewRef = function(index) { + return this._lookupByIndex.get(index); + }; + RenderProtoViewRefStore.prototype.deserialize = function(index) { + if (index == null) { + return null; + } + if (this._onWebworker) { + return new WebWorkerRenderProtoViewRef(index); + } else { + return this.retreiveRenderProtoViewRef(index); + } + }; + RenderProtoViewRefStore.prototype.serialize = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebworker) { + return ref.refNumber; + } else { + return this.storeRenderProtoViewRef(ref); + } + }; + RenderProtoViewRefStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderProtoViewRefStore); + return RenderProtoViewRefStore; + })(); + exports.RenderProtoViewRefStore = RenderProtoViewRefStore; + var WebWorkerRenderProtoViewRef = (function(_super) { + __extends(WebWorkerRenderProtoViewRef, _super); + function WebWorkerRenderProtoViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + return WebWorkerRenderProtoViewRef; + })(api_1.RenderProtoViewRef); + exports.WebWorkerRenderProtoViewRef = WebWorkerRenderProtoViewRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/render_view_with_fragments_store", ["angular2/src/core/di", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var collection_1 = require("angular2/src/core/facade/collection"); + var RenderViewWithFragmentsStore = (function() { + function RenderViewWithFragmentsStore(onWebWorker) { + this._nextIndex = 0; + this._onWebWorker = onWebWorker; + this._lookupByIndex = new Map(); + this._lookupByView = new Map(); + this._viewFragments = new Map(); + } + RenderViewWithFragmentsStore.prototype.allocate = function(fragmentCount) { + var initialIndex = this._nextIndex; + var viewRef = new WebWorkerRenderViewRef(this._nextIndex++); + var fragmentRefs = collection_1.ListWrapper.createGrowableSize(fragmentCount); + for (var i = 0; i < fragmentCount; i++) { + fragmentRefs[i] = new WebWorkerRenderFragmentRef(this._nextIndex++); + } + var renderViewWithFragments = new api_1.RenderViewWithFragments(viewRef, fragmentRefs); + this.store(renderViewWithFragments, initialIndex); + return renderViewWithFragments; + }; + RenderViewWithFragmentsStore.prototype.store = function(view, startIndex) { + var _this = this; + this._lookupByIndex.set(startIndex, view.viewRef); + this._lookupByView.set(view.viewRef, startIndex); + startIndex++; + collection_1.ListWrapper.forEach(view.fragmentRefs, function(ref) { + _this._lookupByIndex.set(startIndex, ref); + _this._lookupByView.set(ref, startIndex); + startIndex++; + }); + this._viewFragments.set(view.viewRef, view.fragmentRefs); + }; + RenderViewWithFragmentsStore.prototype.remove = function(view) { + var _this = this; + this._removeRef(view); + var fragments = this._viewFragments.get(view); + fragments.forEach(function(fragment) { + _this._removeRef(fragment); + }); + collection_1.MapWrapper.delete(this._viewFragments, view); + }; + RenderViewWithFragmentsStore.prototype._removeRef = function(ref) { + var index = this._lookupByView.get(ref); + collection_1.MapWrapper.delete(this._lookupByView, ref); + collection_1.MapWrapper.delete(this._lookupByIndex, index); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderViewRef = function(viewRef) { + return this._serializeRenderFragmentOrViewRef(viewRef); + }; + RenderViewWithFragmentsStore.prototype.serializeRenderFragmentRef = function(fragmentRef) { + return this._serializeRenderFragmentOrViewRef(fragmentRef); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderViewRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype.deserializeRenderFragmentRef = function(ref) { + if (ref == null) { + return null; + } + return this._retrieve(ref); + }; + RenderViewWithFragmentsStore.prototype._retrieve = function(ref) { + if (ref == null) { + return null; + } + if (!this._lookupByIndex.has(ref)) { + return null; + } + return this._lookupByIndex.get(ref); + }; + RenderViewWithFragmentsStore.prototype._serializeRenderFragmentOrViewRef = function(ref) { + if (ref == null) { + return null; + } + if (this._onWebWorker) { + return ref.serialize(); + } else { + return this._lookupByView.get(ref); + } + }; + RenderViewWithFragmentsStore.prototype.serializeViewWithFragments = function(view) { + var _this = this; + if (view == null) { + return null; + } + if (this._onWebWorker) { + return { + 'viewRef': view.viewRef.serialize(), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return val.serialize(); + }) + }; + } else { + return { + 'viewRef': this._lookupByView.get(view.viewRef), + 'fragmentRefs': collection_1.ListWrapper.map(view.fragmentRefs, function(val) { + return _this._lookupByView.get(val); + }) + }; + } + }; + RenderViewWithFragmentsStore.prototype.deserializeViewWithFragments = function(obj) { + var _this = this; + if (obj == null) { + return null; + } + var viewRef = this.deserializeRenderViewRef(obj['viewRef']); + var fragments = collection_1.ListWrapper.map(obj['fragmentRefs'], function(val) { + return _this.deserializeRenderFragmentRef(val); + }); + return new api_1.RenderViewWithFragments(viewRef, fragments); + }; + RenderViewWithFragmentsStore = __decorate([di_1.Injectable(), __param(0, di_1.Inject(api_2.ON_WEB_WORKER)), __metadata('design:paramtypes', [Object])], RenderViewWithFragmentsStore); + return RenderViewWithFragmentsStore; + })(); + exports.RenderViewWithFragmentsStore = RenderViewWithFragmentsStore; + var WebWorkerRenderViewRef = (function(_super) { + __extends(WebWorkerRenderViewRef, _super); + function WebWorkerRenderViewRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderViewRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderViewRef.deserialize = function(ref) { + return new WebWorkerRenderViewRef(ref); + }; + return WebWorkerRenderViewRef; + })(api_1.RenderViewRef); + exports.WebWorkerRenderViewRef = WebWorkerRenderViewRef; + var WebWorkerRenderFragmentRef = (function(_super) { + __extends(WebWorkerRenderFragmentRef, _super); + function WebWorkerRenderFragmentRef(refNumber) { + _super.call(this); + this.refNumber = refNumber; + } + WebWorkerRenderFragmentRef.prototype.serialize = function() { + return this.refNumber; + }; + WebWorkerRenderFragmentRef.deserialize = function(ref) { + return new WebWorkerRenderFragmentRef(ref); + }; + return WebWorkerRenderFragmentRef; + })(api_1.RenderFragmentRef); + exports.WebWorkerRenderFragmentRef = WebWorkerRenderFragmentRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/messaging_api", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + exports.SETUP_CHANNEL = "ng-WebWorkerSetup"; + exports.RENDER_COMPILER_CHANNEL = "ng-RenderCompiler"; + exports.RENDERER_CHANNEL = "ng-Renderer"; + exports.XHR_CHANNEL = "ng-XHR"; + exports.EVENT_CHANNEL = "ng-events"; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/event_deserializer", [], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function deserializeGenericEvent(serializedEvent) { + return serializedEvent; + } + exports.deserializeGenericEvent = deserializeGenericEvent; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/service_message_broker", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/web_workers/shared/serializer", "angular2/src/core/facade/lang", "angular2/src/web_workers/shared/message_bus", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var lang_1 = require("angular2/src/core/facade/lang"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var async_1 = require("angular2/src/core/facade/async"); + var ServiceMessageBrokerFactory = (function() { + function ServiceMessageBrokerFactory(_messageBus, _serializer) { + this._messageBus = _messageBus; + this._serializer = _serializer; + } + ServiceMessageBrokerFactory.prototype.createMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this._messageBus.initChannel(channel, runInZone); + return new ServiceMessageBroker(this._messageBus, this._serializer, channel); + }; + ServiceMessageBrokerFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, serializer_1.Serializer])], ServiceMessageBrokerFactory); + return ServiceMessageBrokerFactory; + })(); + exports.ServiceMessageBrokerFactory = ServiceMessageBrokerFactory; + var ServiceMessageBroker = (function() { + function ServiceMessageBroker(messageBus, _serializer, channel) { + var _this = this; + this._serializer = _serializer; + this.channel = channel; + this._methods = new collection_1.Map(); + this._sink = messageBus.to(channel); + var source = messageBus.from(channel); + async_1.ObservableWrapper.subscribe(source, function(message) { + return _this._handleMessage(message); + }); + } + ServiceMessageBroker.prototype.registerMethod = function(methodName, signature, method, returnType) { + var _this = this; + this._methods.set(methodName, function(message) { + var serializedArgs = message.args; + var deserializedArgs = collection_1.ListWrapper.createFixedSize(signature.length); + for (var i = 0; i < signature.length; i++) { + var serializedArg = serializedArgs[i]; + deserializedArgs[i] = _this._serializer.deserialize(serializedArg, signature[i]); + } + var promise = lang_1.FunctionWrapper.apply(method, deserializedArgs); + if (lang_1.isPresent(returnType) && lang_1.isPresent(promise)) { + _this._wrapWebWorkerPromise(message.id, promise, returnType); + } + }); + }; + ServiceMessageBroker.prototype._handleMessage = function(map) { + var message = new ReceivedMessage(map); + if (this._methods.has(message.method)) { + this._methods.get(message.method)(message); + } + }; + ServiceMessageBroker.prototype._wrapWebWorkerPromise = function(id, promise, type) { + var _this = this; + async_1.PromiseWrapper.then(promise, function(result) { + async_1.ObservableWrapper.callNext(_this._sink, { + 'type': 'result', + 'value': _this._serializer.serialize(result, type), + 'id': id + }); + }); + }; + return ServiceMessageBroker; + })(); + exports.ServiceMessageBroker = ServiceMessageBroker; + var ReceivedMessage = (function() { + function ReceivedMessage(data) { + this.method = data['method']; + this.args = data['args']; + this.id = data['id']; + this.type = data['type']; + } + return ReceivedMessage; + })(); + exports.ReceivedMessage = ReceivedMessage; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/decorators", ["angular2/src/core/di/metadata", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var metadata_1 = require("angular2/src/core/di/metadata"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Inject = decorators_1.makeParamDecorator(metadata_1.InjectMetadata); + exports.Optional = decorators_1.makeParamDecorator(metadata_1.OptionalMetadata); + exports.Injectable = decorators_1.makeDecorator(metadata_1.InjectableMetadata); + exports.Self = decorators_1.makeParamDecorator(metadata_1.SelfMetadata); + exports.Host = decorators_1.makeParamDecorator(metadata_1.HostMetadata); + exports.SkipSelf = decorators_1.makeParamDecorator(metadata_1.SkipSelfMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/exceptions", ["angular2/src/core/facade/exception_handler", "angular2/src/core/facade/exception_handler"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var exception_handler_1 = require("angular2/src/core/facade/exception_handler"); + var exception_handler_2 = require("angular2/src/core/facade/exception_handler"); + exports.ExceptionHandler = exception_handler_2.ExceptionHandler; + var BaseException = (function(_super) { + __extends(BaseException, _super); + function BaseException(message) { + if (message === void 0) { + message = "--"; + } + _super.call(this, message); + this.message = message; + this.stack = (new Error(message)).stack; + } + BaseException.prototype.toString = function() { + return this.message; + }; + return BaseException; + })(Error); + exports.BaseException = BaseException; + var WrappedException = (function(_super) { + __extends(WrappedException, _super); + function WrappedException(_wrapperMessage, _originalException, _originalStack, _context) { + _super.call(this, _wrapperMessage); + this._wrapperMessage = _wrapperMessage; + this._originalException = _originalException; + this._originalStack = _originalStack; + this._context = _context; + this._wrapperStack = (new Error(_wrapperMessage)).stack; + } + Object.defineProperty(WrappedException.prototype, "wrapperMessage", { + get: function() { + return this._wrapperMessage; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "wrapperStack", { + get: function() { + return this._wrapperStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalException", { + get: function() { + return this._originalException; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "originalStack", { + get: function() { + return this._originalStack; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "context", { + get: function() { + return this._context; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(WrappedException.prototype, "message", { + get: function() { + return exception_handler_1.ExceptionHandler.exceptionToString(this); + }, + enumerable: true, + configurable: true + }); + WrappedException.prototype.toString = function() { + return this.message; + }; + return WrappedException; + })(Error); + exports.WrappedException = WrappedException; + function makeTypeError(message) { + return new TypeError(message); + } + exports.makeTypeError = makeTypeError; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/reflection/reflection", ["angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflector", "angular2/src/core/reflection/reflection_capabilities"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var reflector_1 = require("angular2/src/core/reflection/reflector"); + var reflector_2 = require("angular2/src/core/reflection/reflector"); + exports.Reflector = reflector_2.Reflector; + exports.ReflectionInfo = reflector_2.ReflectionInfo; + var reflection_capabilities_1 = require("angular2/src/core/reflection/reflection_capabilities"); + exports.reflector = new reflector_1.Reflector(new reflection_capabilities_1.ReflectionCapabilities()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/key", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/di/type_literal", "angular2/src/core/di/forward_ref", "angular2/src/core/di/type_literal"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var type_literal_1 = require("angular2/src/core/di/type_literal"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var type_literal_2 = require("angular2/src/core/di/type_literal"); + exports.TypeLiteral = type_literal_2.TypeLiteral; + var Key = (function() { + function Key(token, id) { + this.token = token; + this.id = id; + if (lang_1.isBlank(token)) { + throw new exceptions_1.BaseException('Token must be defined!'); + } + } + Object.defineProperty(Key.prototype, "displayName", { + get: function() { + return lang_1.stringify(this.token); + }, + enumerable: true, + configurable: true + }); + Key.get = function(token) { + return _globalKeyRegistry.get(forward_ref_1.resolveForwardRef(token)); + }; + Object.defineProperty(Key, "numberOfKeys", { + get: function() { + return _globalKeyRegistry.numberOfKeys; + }, + enumerable: true, + configurable: true + }); + return Key; + })(); + exports.Key = Key; + var KeyRegistry = (function() { + function KeyRegistry() { + this._allKeys = new Map(); + } + KeyRegistry.prototype.get = function(token) { + if (token instanceof Key) + return token; + var theToken = token; + if (token instanceof type_literal_1.TypeLiteral) { + theToken = token.type; + } + token = theToken; + if (this._allKeys.has(token)) { + return this._allKeys.get(token); + } + var newKey = new Key(token, Key.numberOfKeys); + this._allKeys.set(token, newKey); + return newKey; + }; + Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { + get: function() { + return collection_1.MapWrapper.size(this._allKeys); + }, + enumerable: true, + configurable: true + }); + return KeyRegistry; + })(); + exports.KeyRegistry = KeyRegistry; + var _globalKeyRegistry = new KeyRegistry(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_util", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/pipe_lifecycle_reflector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var pipe_lifecycle_reflector_1 = require("angular2/src/core/change_detection/pipe_lifecycle_reflector"); + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var WrappedValue = (function() { + function WrappedValue(wrapped) { + this.wrapped = wrapped; + } + WrappedValue.wrap = function(value) { + var w = _wrappedValues[_wrappedIndex++ % 5]; + w.wrapped = value; + return w; + }; + return WrappedValue; + })(); + exports.WrappedValue = WrappedValue; + var _wrappedValues = [new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null), new WrappedValue(null)]; + var _wrappedIndex = 0; + var SimpleChange = (function() { + function SimpleChange(previousValue, currentValue) { + this.previousValue = previousValue; + this.currentValue = currentValue; + } + SimpleChange.prototype.isFirstChange = function() { + return this.previousValue === ChangeDetectionUtil.uninitialized; + }; + return SimpleChange; + })(); + exports.SimpleChange = SimpleChange; + var _simpleChangesIndex = 0; + var _simpleChanges = [new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null), new SimpleChange(null, null)]; + function _simpleChange(previousValue, currentValue) { + var index = _simpleChangesIndex++ % 20; + var s = _simpleChanges[index]; + s.previousValue = previousValue; + s.currentValue = currentValue; + return s; + } + var ChangeDetectionUtil = (function() { + function ChangeDetectionUtil() {} + ChangeDetectionUtil.arrayFn0 = function() { + return []; + }; + ChangeDetectionUtil.arrayFn1 = function(a1) { + return [a1]; + }; + ChangeDetectionUtil.arrayFn2 = function(a1, a2) { + return [a1, a2]; + }; + ChangeDetectionUtil.arrayFn3 = function(a1, a2, a3) { + return [a1, a2, a3]; + }; + ChangeDetectionUtil.arrayFn4 = function(a1, a2, a3, a4) { + return [a1, a2, a3, a4]; + }; + ChangeDetectionUtil.arrayFn5 = function(a1, a2, a3, a4, a5) { + return [a1, a2, a3, a4, a5]; + }; + ChangeDetectionUtil.arrayFn6 = function(a1, a2, a3, a4, a5, a6) { + return [a1, a2, a3, a4, a5, a6]; + }; + ChangeDetectionUtil.arrayFn7 = function(a1, a2, a3, a4, a5, a6, a7) { + return [a1, a2, a3, a4, a5, a6, a7]; + }; + ChangeDetectionUtil.arrayFn8 = function(a1, a2, a3, a4, a5, a6, a7, a8) { + return [a1, a2, a3, a4, a5, a6, a7, a8]; + }; + ChangeDetectionUtil.arrayFn9 = function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return [a1, a2, a3, a4, a5, a6, a7, a8, a9]; + }; + ChangeDetectionUtil.operation_negate = function(value) { + return !value; + }; + ChangeDetectionUtil.operation_add = function(left, right) { + return left + right; + }; + ChangeDetectionUtil.operation_subtract = function(left, right) { + return left - right; + }; + ChangeDetectionUtil.operation_multiply = function(left, right) { + return left * right; + }; + ChangeDetectionUtil.operation_divide = function(left, right) { + return left / right; + }; + ChangeDetectionUtil.operation_remainder = function(left, right) { + return left % right; + }; + ChangeDetectionUtil.operation_equals = function(left, right) { + return left == right; + }; + ChangeDetectionUtil.operation_not_equals = function(left, right) { + return left != right; + }; + ChangeDetectionUtil.operation_identical = function(left, right) { + return left === right; + }; + ChangeDetectionUtil.operation_not_identical = function(left, right) { + return left !== right; + }; + ChangeDetectionUtil.operation_less_then = function(left, right) { + return left < right; + }; + ChangeDetectionUtil.operation_greater_then = function(left, right) { + return left > right; + }; + ChangeDetectionUtil.operation_less_or_equals_then = function(left, right) { + return left <= right; + }; + ChangeDetectionUtil.operation_greater_or_equals_then = function(left, right) { + return left >= right; + }; + ChangeDetectionUtil.operation_logical_and = function(left, right) { + return left && right; + }; + ChangeDetectionUtil.operation_logical_or = function(left, right) { + return left || right; + }; + ChangeDetectionUtil.cond = function(cond, trueVal, falseVal) { + return cond ? trueVal : falseVal; + }; + ChangeDetectionUtil.mapFn = function(keys) { + function buildMap(values) { + var res = collection_1.StringMapWrapper.create(); + for (var i = 0; i < keys.length; ++i) { + collection_1.StringMapWrapper.set(res, keys[i], values[i]); + } + return res; + } + switch (keys.length) { + case 0: + return function() { + return []; + }; + case 1: + return function(a1) { + return buildMap([a1]); + }; + case 2: + return function(a1, a2) { + return buildMap([a1, a2]); + }; + case 3: + return function(a1, a2, a3) { + return buildMap([a1, a2, a3]); + }; + case 4: + return function(a1, a2, a3, a4) { + return buildMap([a1, a2, a3, a4]); + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return buildMap([a1, a2, a3, a4, a5]); + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return buildMap([a1, a2, a3, a4, a5, a6]); + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return buildMap([a1, a2, a3, a4, a5, a6, a7]); + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8]); + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return buildMap([a1, a2, a3, a4, a5, a6, a7, a8, a9]); + }; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + }; + ChangeDetectionUtil.keyedAccess = function(obj, args) { + return obj[args[0]]; + }; + ChangeDetectionUtil.unwrapValue = function(value) { + if (value instanceof WrappedValue) { + return value.wrapped; + } else { + return value; + } + }; + ChangeDetectionUtil.changeDetectionMode = function(strategy) { + return constants_1.isDefaultChangeDetectionStrategy(strategy) ? constants_1.ChangeDetectionStrategy.CheckAlways : constants_1.ChangeDetectionStrategy.CheckOnce; + }; + ChangeDetectionUtil.simpleChange = function(previousValue, currentValue) { + return _simpleChange(previousValue, currentValue); + }; + ChangeDetectionUtil.isValueBlank = function(value) { + return lang_1.isBlank(value); + }; + ChangeDetectionUtil.s = function(value) { + return lang_1.isPresent(value) ? "" + value : ''; + }; + ChangeDetectionUtil.protoByIndex = function(protos, selfIndex) { + return selfIndex < 1 ? null : protos[selfIndex - 1]; + }; + ChangeDetectionUtil.callPipeOnDestroy = function(selectedPipe) { + if (pipe_lifecycle_reflector_1.implementsOnDestroy(selectedPipe.pipe)) { + selectedPipe.pipe.onDestroy(); + } + }; + ChangeDetectionUtil.bindingTarget = function(mode, elementIndex, name, unit, debug) { + return new binding_record_1.BindingTarget(mode, elementIndex, name, unit, debug); + }; + ChangeDetectionUtil.directiveIndex = function(elementIndex, directiveIndex) { + return new directive_record_1.DirectiveIndex(elementIndex, directiveIndex); + }; + ChangeDetectionUtil.uninitialized = lang_1.CONST_EXPR(new Object()); + return ChangeDetectionUtil; + })(); + exports.ChangeDetectionUtil = ChangeDetectionUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/profile/profile", ["angular2/src/core/profile/wtf_impl"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var impl = require("angular2/src/core/profile/wtf_impl"); + exports.wtfEnabled = impl.detectWTF(); + function noopScope(arg0, arg1) { + return null; + } + exports.wtfCreateScope = exports.wtfEnabled ? impl.createScope : function(signature, flags) { + return noopScope; + }; + exports.wtfLeave = exports.wtfEnabled ? impl.leave : function(s, r) { + return r; + }; + exports.wtfStartTimeRange = exports.wtfEnabled ? impl.startTimeRange : function(rangeType, action) { + return null; + }; + exports.wtfEndTimeRange = exports.wtfEnabled ? impl.endTimeRange : function(r) { + return null; + }; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/codegen_logic_util", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_record", "angular2/src/core/change_detection/constants", "angular2/src/core/facade/exceptions"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var CodegenLogicUtil = (function() { + function CodegenLogicUtil(_names, _utilName, _changeDetection) { + this._names = _names; + this._utilName = _utilName; + this._changeDetection = _changeDetection; + } + CodegenLogicUtil.prototype.genPropertyBindingEvalValue = function(protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getLocalName(idx); + }, this._names.getLocalsAccessorName()); + }; + CodegenLogicUtil.prototype.genEventBindingEvalValue = function(eventRecord, protoRec) { + var _this = this; + return this._genEvalValue(protoRec, function(idx) { + return _this._names.getEventLocalName(eventRecord, idx); + }, "locals"); + }; + CodegenLogicUtil.prototype._genEvalValue = function(protoRec, getLocalName, localsAccessor) { + var context = (protoRec.contextIndex == -1) ? this._names.getDirectiveName(protoRec.directiveIndex) : getLocalName(protoRec.contextIndex); + var argString = collection_1.ListWrapper.map(protoRec.args, function(arg) { + return getLocalName(arg); + }).join(", "); + var rhs; + switch (protoRec.mode) { + case proto_record_1.RecordType.Self: + rhs = context; + break; + case proto_record_1.RecordType.Const: + rhs = codegen_facade_1.codify(protoRec.funcOrValue); + break; + case proto_record_1.RecordType.PropertyRead: + rhs = this._observe(context + "." + protoRec.name, protoRec); + break; + case proto_record_1.RecordType.SafeProperty: + var read = this._observe(context + "." + protoRec.name, protoRec); + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(read, protoRec); + break; + case proto_record_1.RecordType.PropertyWrite: + rhs = context + "." + protoRec.name + " = " + getLocalName(protoRec.args[0]); + break; + case proto_record_1.RecordType.Local: + rhs = this._observe(localsAccessor + ".get(" + codegen_facade_1.rawString(protoRec.name) + ")", protoRec); + break; + case proto_record_1.RecordType.InvokeMethod: + rhs = this._observe(context + "." + protoRec.name + "(" + argString + ")", protoRec); + break; + case proto_record_1.RecordType.SafeMethodInvoke: + var invoke = context + "." + protoRec.name + "(" + argString + ")"; + rhs = this._utilName + ".isValueBlank(" + context + ") ? null : " + this._observe(invoke, protoRec); + break; + case proto_record_1.RecordType.InvokeClosure: + rhs = context + "(" + argString + ")"; + break; + case proto_record_1.RecordType.PrimitiveOp: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.CollectionLiteral: + rhs = this._utilName + "." + protoRec.name + "(" + argString + ")"; + break; + case proto_record_1.RecordType.Interpolate: + rhs = this._genInterpolation(protoRec); + break; + case proto_record_1.RecordType.KeyedRead: + rhs = this._observe(context + "[" + getLocalName(protoRec.args[0]) + "]", protoRec); + break; + case proto_record_1.RecordType.KeyedWrite: + rhs = context + "[" + getLocalName(protoRec.args[0]) + "] = " + getLocalName(protoRec.args[1]); + break; + case proto_record_1.RecordType.Chain: + rhs = 'null'; + break; + default: + throw new exceptions_1.BaseException("Unknown operation " + protoRec.mode); + } + return getLocalName(protoRec.selfIndex) + " = " + rhs + ";"; + }; + CodegenLogicUtil.prototype._observe = function(exp, rec) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeValue(" + exp + ", " + rec.selfIndex + ")"; + } else { + return exp; + } + }; + CodegenLogicUtil.prototype.genPropertyBindingTargets = function(propertyBindingTargets, genDebugInfo) { + var _this = this; + var bs = propertyBindingTargets.map(function(b) { + if (lang_1.isBlank(b)) + return "null"; + var debug = genDebugInfo ? codegen_facade_1.codify(b.debug) : "null"; + return _this._utilName + ".bindingTarget(" + codegen_facade_1.codify(b.mode) + ", " + b.elementIndex + ", " + codegen_facade_1.codify(b.name) + ", " + codegen_facade_1.codify(b.unit) + ", " + debug + ")"; + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype.genDirectiveIndices = function(directiveRecords) { + var _this = this; + var bs = directiveRecords.map(function(b) { + return (_this._utilName + ".directiveIndex(" + b.directiveIndex.elementIndex + ", " + b.directiveIndex.directiveIndex + ")"); + }); + return "[" + bs.join(", ") + "]"; + }; + CodegenLogicUtil.prototype._genInterpolation = function(protoRec) { + var iVals = []; + for (var i = 0; i < protoRec.args.length; ++i) { + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[i])); + iVals.push(this._utilName + ".s(" + this._names.getLocalName(protoRec.args[i]) + ")"); + } + iVals.push(codegen_facade_1.codify(protoRec.fixedArgs[protoRec.args.length])); + return codegen_facade_1.combineGeneratedStrings(iVals); + }; + CodegenLogicUtil.prototype.genHydrateDirectives = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + res.push(this._names.getDirectiveName(r.directiveIndex) + " = " + this._genReadDirective(i) + ";"); + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype._genReadDirective = function(index) { + if (this._changeDetection === constants_1.ChangeDetectionStrategy.OnPushObserve) { + return "this.observeDirective(this.getDirectiveFor(directives, " + index + "), " + index + ")"; + } else { + return "this.getDirectiveFor(directives, " + index + ")"; + } + }; + CodegenLogicUtil.prototype.genHydrateDetectors = function(directiveRecords) { + var res = []; + for (var i = 0; i < directiveRecords.length; ++i) { + var r = directiveRecords[i]; + if (!r.isDefaultChangeDetection()) { + res.push(this._names.getDetectorName(r.directiveIndex) + " = this.getDetectorFor(directives, " + i + ");"); + } + } + return res.join("\n"); + }; + CodegenLogicUtil.prototype.genContentLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterContentInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterContentInit();"); + } + if (dir.callAfterContentChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterContentChecked();"); + } + } + return res; + }; + CodegenLogicUtil.prototype.genViewLifecycleCallbacks = function(directiveRecords) { + var res = []; + for (var i = directiveRecords.length - 1; i >= 0; --i) { + var dir = directiveRecords[i]; + if (dir.callAfterViewInit) { + res.push("if(! " + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(dir.directiveIndex) + ".afterViewInit();"); + } + if (dir.callAfterViewChecked) { + res.push(this._names.getDirectiveName(dir.directiveIndex) + ".afterViewChecked();"); + } + } + return res; + }; + return CodegenLogicUtil; + })(); + exports.CodegenLogicUtil = CodegenLogicUtil; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/proto_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/event_binding", "angular2/src/core/change_detection/coalesce", "angular2/src/core/change_detection/proto_record"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + var event_binding_1 = require("angular2/src/core/change_detection/event_binding"); + var coalesce_1 = require("angular2/src/core/change_detection/coalesce"); + var proto_record_1 = require("angular2/src/core/change_detection/proto_record"); + var DynamicProtoChangeDetector = (function() { + function DynamicProtoChangeDetector(_definition) { + this._definition = _definition; + this._propertyBindingRecords = createPropertyRecords(_definition); + this._eventBindingRecords = createEventRecords(_definition); + this._propertyBindingTargets = this._definition.bindingRecords.map(function(b) { + return b.target; + }); + this._directiveIndices = this._definition.directiveRecords.map(function(d) { + return d.directiveIndex; + }); + } + DynamicProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return new dynamic_change_detector_1.DynamicChangeDetector(this._definition.id, dispatcher, this._propertyBindingRecords.length, this._propertyBindingTargets, this._directiveIndices, this._definition.strategy, this._propertyBindingRecords, this._eventBindingRecords, this._definition.directiveRecords, this._definition.genConfig); + }; + return DynamicProtoChangeDetector; + })(); + exports.DynamicProtoChangeDetector = DynamicProtoChangeDetector; + function createPropertyRecords(definition) { + var recordBuilder = new ProtoRecordBuilder(); + collection_1.ListWrapper.forEachWithIndex(definition.bindingRecords, function(b, index) { + return recordBuilder.add(b, definition.variableNames, index); + }); + return coalesce_1.coalesce(recordBuilder.records); + } + exports.createPropertyRecords = createPropertyRecords; + function createEventRecords(definition) { + var varNames = collection_1.ListWrapper.concat(['$event'], definition.variableNames); + return definition.eventRecords.map(function(er) { + var records = _ConvertAstIntoProtoRecords.create(er, varNames); + var dirIndex = er.implicitReceiver instanceof directive_record_1.DirectiveIndex ? er.implicitReceiver : null; + return new event_binding_1.EventBinding(er.target.name, er.target.elementIndex, dirIndex, records); + }); + } + exports.createEventRecords = createEventRecords; + var ProtoRecordBuilder = (function() { + function ProtoRecordBuilder() { + this.records = []; + } + ProtoRecordBuilder.prototype.add = function(b, variableNames, bindingIndex) { + var oldLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) { + oldLast.lastInDirective = false; + } + var numberOfRecordsBefore = this.records.length; + this._appendRecords(b, variableNames, bindingIndex); + var newLast = collection_1.ListWrapper.last(this.records); + if (lang_1.isPresent(newLast) && newLast !== oldLast) { + newLast.lastInBinding = true; + newLast.lastInDirective = true; + this._setArgumentToPureFunction(numberOfRecordsBefore); + } + }; + ProtoRecordBuilder.prototype._setArgumentToPureFunction = function(startIndex) { + var _this = this; + for (var i = startIndex; i < this.records.length; ++i) { + var rec = this.records[i]; + if (rec.isPureFunction()) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + } + if (rec.mode === proto_record_1.RecordType.Pipe) { + rec.args.forEach(function(recordIndex) { + return _this.records[recordIndex - 1].argumentToPureFunction = true; + }); + this.records[rec.contextIndex - 1].argumentToPureFunction = true; + } + } + }; + ProtoRecordBuilder.prototype._appendRecords = function(b, variableNames, bindingIndex) { + if (b.isDirectiveLifecycle()) { + this.records.push(new proto_record_1.ProtoRecord(proto_record_1.RecordType.DirectiveLifecycle, b.lifecycleEvent, null, [], [], -1, null, this.records.length + 1, b, false, false, false, false, null)); + } else { + _ConvertAstIntoProtoRecords.append(this.records, b, variableNames, bindingIndex); + } + }; + return ProtoRecordBuilder; + })(); + exports.ProtoRecordBuilder = ProtoRecordBuilder; + var _ConvertAstIntoProtoRecords = (function() { + function _ConvertAstIntoProtoRecords(_records, _bindingRecord, _variableNames, _bindingIndex) { + this._records = _records; + this._bindingRecord = _bindingRecord; + this._variableNames = _variableNames; + this._bindingIndex = _bindingIndex; + } + _ConvertAstIntoProtoRecords.append = function(records, b, variableNames, bindingIndex) { + var c = new _ConvertAstIntoProtoRecords(records, b, variableNames, bindingIndex); + b.ast.visit(c); + }; + _ConvertAstIntoProtoRecords.create = function(b, variableNames) { + var rec = []; + _ConvertAstIntoProtoRecords.append(rec, b, variableNames, null); + rec[rec.length - 1].lastInBinding = true; + return rec; + }; + _ConvertAstIntoProtoRecords.prototype.visitImplicitReceiver = function(ast) { + return this._bindingRecord.implicitReceiver; + }; + _ConvertAstIntoProtoRecords.prototype.visitInterpolation = function(ast) { + var args = this._visitAll(ast.expressions); + return this._addRecord(proto_record_1.RecordType.Interpolate, "interpolate", _interpolationFn(ast.strings), args, ast.strings, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralPrimitive = function(ast) { + return this._addRecord(proto_record_1.RecordType.Const, "literal", ast.value, [], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + return this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + } else { + return this._addRecord(proto_record_1.RecordType.PropertyRead, ast.name, ast.getter, [], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitPropertyWrite = function(ast) { + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name) && ast.receiver instanceof ast_1.ImplicitReceiver) { + throw new exceptions_1.BaseException("Cannot reassign a variable binding " + ast.name); + } else { + var receiver = ast.receiver.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.PropertyWrite, ast.name, ast.setter, [value], null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedWrite = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + var value = ast.value.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedWrite, null, null, [key, value], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitSafePropertyRead = function(ast) { + var receiver = ast.receiver.visit(this); + return this._addRecord(proto_record_1.RecordType.SafeProperty, ast.name, ast.getter, [], null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + if (lang_1.isPresent(this._variableNames) && collection_1.ListWrapper.contains(this._variableNames, ast.name)) { + var target = this._addRecord(proto_record_1.RecordType.Local, ast.name, ast.name, [], null, receiver); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + } else { + return this._addRecord(proto_record_1.RecordType.InvokeMethod, ast.name, ast.fn, args, null, receiver); + } + }; + _ConvertAstIntoProtoRecords.prototype.visitSafeMethodCall = function(ast) { + var receiver = ast.receiver.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.SafeMethodInvoke, ast.name, ast.fn, args, null, receiver); + }; + _ConvertAstIntoProtoRecords.prototype.visitFunctionCall = function(ast) { + var target = ast.target.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.InvokeClosure, "closure", null, args, null, target); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralArray = function(ast) { + var primitiveName = "arrayFn" + ast.expressions.length; + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, primitiveName, _arrayFn(ast.expressions.length), this._visitAll(ast.expressions), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitLiteralMap = function(ast) { + return this._addRecord(proto_record_1.RecordType.CollectionLiteral, _mapPrimitiveName(ast.keys), change_detection_util_1.ChangeDetectionUtil.mapFn(ast.keys), this._visitAll(ast.values), null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitBinary = function(ast) { + var left = ast.left.visit(this); + var right = ast.right.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, _operationToPrimitiveName(ast.operation), _operationToFunction(ast.operation), [left, right], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPrefixNot = function(ast) { + var exp = ast.expression.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "operation_negate", change_detection_util_1.ChangeDetectionUtil.operation_negate, [exp], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitConditional = function(ast) { + var c = ast.condition.visit(this); + var t = ast.trueExp.visit(this); + var f = ast.falseExp.visit(this); + return this._addRecord(proto_record_1.RecordType.PrimitiveOp, "cond", change_detection_util_1.ChangeDetectionUtil.cond, [c, t, f], null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitPipe = function(ast) { + var value = ast.exp.visit(this); + var args = this._visitAll(ast.args); + return this._addRecord(proto_record_1.RecordType.Pipe, ast.name, ast.name, args, null, value); + }; + _ConvertAstIntoProtoRecords.prototype.visitKeyedRead = function(ast) { + var obj = ast.obj.visit(this); + var key = ast.key.visit(this); + return this._addRecord(proto_record_1.RecordType.KeyedRead, "keyedAccess", change_detection_util_1.ChangeDetectionUtil.keyedAccess, [key], null, obj); + }; + _ConvertAstIntoProtoRecords.prototype.visitChain = function(ast) { + var _this = this; + var args = ast.expressions.map(function(e) { + return e.visit(_this); + }); + return this._addRecord(proto_record_1.RecordType.Chain, "chain", null, args, null, 0); + }; + _ConvertAstIntoProtoRecords.prototype.visitIf = function(ast) { + throw new exceptions_1.BaseException('Not supported'); + }; + _ConvertAstIntoProtoRecords.prototype._visitAll = function(asts) { + var res = collection_1.ListWrapper.createFixedSize(asts.length); + for (var i = 0; i < asts.length; ++i) { + res[i] = asts[i].visit(this); + } + return res; + }; + _ConvertAstIntoProtoRecords.prototype._addRecord = function(type, name, funcOrValue, args, fixedArgs, context) { + var selfIndex = this._records.length + 1; + if (context instanceof directive_record_1.DirectiveIndex) { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } else { + this._records.push(new proto_record_1.ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, selfIndex, this._bindingRecord, false, false, false, false, this._bindingIndex)); + } + return selfIndex; + }; + return _ConvertAstIntoProtoRecords; + })(); + function _arrayFn(length) { + switch (length) { + case 0: + return change_detection_util_1.ChangeDetectionUtil.arrayFn0; + case 1: + return change_detection_util_1.ChangeDetectionUtil.arrayFn1; + case 2: + return change_detection_util_1.ChangeDetectionUtil.arrayFn2; + case 3: + return change_detection_util_1.ChangeDetectionUtil.arrayFn3; + case 4: + return change_detection_util_1.ChangeDetectionUtil.arrayFn4; + case 5: + return change_detection_util_1.ChangeDetectionUtil.arrayFn5; + case 6: + return change_detection_util_1.ChangeDetectionUtil.arrayFn6; + case 7: + return change_detection_util_1.ChangeDetectionUtil.arrayFn7; + case 8: + return change_detection_util_1.ChangeDetectionUtil.arrayFn8; + case 9: + return change_detection_util_1.ChangeDetectionUtil.arrayFn9; + default: + throw new exceptions_1.BaseException("Does not support literal maps with more than 9 elements"); + } + } + function _mapPrimitiveName(keys) { + var stringifiedKeys = collection_1.ListWrapper.join(collection_1.ListWrapper.map(keys, function(k) { + return lang_1.isString(k) ? "\"" + k + "\"" : "" + k; + }), ", "); + return "mapFn([" + stringifiedKeys + "])"; + } + function _operationToPrimitiveName(operation) { + switch (operation) { + case '+': + return "operation_add"; + case '-': + return "operation_subtract"; + case '*': + return "operation_multiply"; + case '/': + return "operation_divide"; + case '%': + return "operation_remainder"; + case '==': + return "operation_equals"; + case '!=': + return "operation_not_equals"; + case '===': + return "operation_identical"; + case '!==': + return "operation_not_identical"; + case '<': + return "operation_less_then"; + case '>': + return "operation_greater_then"; + case '<=': + return "operation_less_or_equals_then"; + case '>=': + return "operation_greater_or_equals_then"; + case '&&': + return "operation_logical_and"; + case '||': + return "operation_logical_or"; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function _operationToFunction(operation) { + switch (operation) { + case '+': + return change_detection_util_1.ChangeDetectionUtil.operation_add; + case '-': + return change_detection_util_1.ChangeDetectionUtil.operation_subtract; + case '*': + return change_detection_util_1.ChangeDetectionUtil.operation_multiply; + case '/': + return change_detection_util_1.ChangeDetectionUtil.operation_divide; + case '%': + return change_detection_util_1.ChangeDetectionUtil.operation_remainder; + case '==': + return change_detection_util_1.ChangeDetectionUtil.operation_equals; + case '!=': + return change_detection_util_1.ChangeDetectionUtil.operation_not_equals; + case '===': + return change_detection_util_1.ChangeDetectionUtil.operation_identical; + case '!==': + return change_detection_util_1.ChangeDetectionUtil.operation_not_identical; + case '<': + return change_detection_util_1.ChangeDetectionUtil.operation_less_then; + case '>': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_then; + case '<=': + return change_detection_util_1.ChangeDetectionUtil.operation_less_or_equals_then; + case '>=': + return change_detection_util_1.ChangeDetectionUtil.operation_greater_or_equals_then; + case '&&': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_and; + case '||': + return change_detection_util_1.ChangeDetectionUtil.operation_logical_or; + default: + throw new exceptions_1.BaseException("Unsupported operation " + operation); + } + } + function s(v) { + return lang_1.isPresent(v) ? "" + v : ''; + } + function _interpolationFn(strings) { + var length = strings.length; + var c0 = length > 0 ? strings[0] : null; + var c1 = length > 1 ? strings[1] : null; + var c2 = length > 2 ? strings[2] : null; + var c3 = length > 3 ? strings[3] : null; + var c4 = length > 4 ? strings[4] : null; + var c5 = length > 5 ? strings[5] : null; + var c6 = length > 6 ? strings[6] : null; + var c7 = length > 7 ? strings[7] : null; + var c8 = length > 8 ? strings[8] : null; + var c9 = length > 9 ? strings[9] : null; + switch (length - 1) { + case 1: + return function(a1) { + return c0 + s(a1) + c1; + }; + case 2: + return function(a1, a2) { + return c0 + s(a1) + c1 + s(a2) + c2; + }; + case 3: + return function(a1, a2, a3) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3; + }; + case 4: + return function(a1, a2, a3, a4) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4; + }; + case 5: + return function(a1, a2, a3, a4, a5) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5; + }; + case 6: + return function(a1, a2, a3, a4, a5, a6) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6; + }; + case 7: + return function(a1, a2, a3, a4, a5, a6, a7) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7; + }; + case 8: + return function(a1, a2, a3, a4, a5, a6, a7, a8) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8; + }; + case 9: + return function(a1, a2, a3, a4, a5, a6, a7, a8, a9) { + return c0 + s(a1) + c1 + s(a2) + c2 + s(a3) + c3 + s(a4) + c4 + s(a5) + c5 + s(a6) + c6 + s(a7) + c7 + s(a8) + c8 + s(a9) + c9; + }; + default: + throw new exceptions_1.BaseException("Does not support more than 9 expressions"); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/view", ["angular2/src/core/facade/lang", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var api_1 = require("angular2/src/core/render/api"); + exports.ViewEncapsulation = api_1.ViewEncapsulation; + var ViewMetadata = (function() { + function ViewMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + templateUrl = _b.templateUrl, + template = _b.template, + directives = _b.directives, + pipes = _b.pipes, + encapsulation = _b.encapsulation, + styles = _b.styles, + styleUrls = _b.styleUrls; + this.templateUrl = templateUrl; + this.template = template; + this.styleUrls = styleUrls; + this.styles = styles; + this.directives = directives; + this.pipes = pipes; + this.encapsulation = encapsulation; + } + ViewMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ViewMetadata); + return ViewMetadata; + })(); + exports.ViewMetadata = ViewMetadata; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Subscriber", ["@reactivex/rxjs/dist/cjs/util/noop", "@reactivex/rxjs/dist/cjs/util/throwError", "@reactivex/rxjs/dist/cjs/util/tryOrOnError", "@reactivex/rxjs/dist/cjs/Subscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _createClass = (function() { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ('value' in descriptor) + descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function(Constructor, protoProps, staticProps) { + if (protoProps) + defineProperties(Constructor.prototype, protoProps); + if (staticProps) + defineProperties(Constructor, staticProps); + return Constructor; + }; + })(); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _utilNoop = require("@reactivex/rxjs/dist/cjs/util/noop"); + var _utilNoop2 = _interopRequireDefault(_utilNoop); + var _utilThrowError = require("@reactivex/rxjs/dist/cjs/util/throwError"); + var _utilThrowError2 = _interopRequireDefault(_utilThrowError); + var _utilTryOrOnError = require("@reactivex/rxjs/dist/cjs/util/tryOrOnError"); + var _utilTryOrOnError2 = _interopRequireDefault(_utilTryOrOnError); + var _Subscription2 = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription3 = _interopRequireDefault(_Subscription2); + var Subscriber = (function(_Subscription) { + _inherits(Subscriber, _Subscription); + function Subscriber(destination) { + _classCallCheck(this, Subscriber); + _Subscription.call(this); + this._isUnsubscribed = false; + this.destination = destination; + if (!destination) { + return ; + } + var subscription = destination._subscription; + if (subscription) { + this._subscription = subscription; + } else if (destination instanceof Subscriber) { + this._subscription = destination; + } + } + Subscriber.create = function create(next, error, complete) { + var subscriber = new Subscriber(); + subscriber._next = typeof next === "function" && _utilTryOrOnError2['default'](next) || _utilNoop2['default']; + subscriber._error = typeof error === "function" && error || _utilThrowError2['default']; + subscriber._complete = typeof complete === "function" && complete || _utilNoop2['default']; + return subscriber; + }; + Subscriber.prototype._next = function _next(value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function _error(err) { + this.destination.error(err); + }; + Subscriber.prototype._complete = function _complete() { + this.destination.complete(); + }; + Subscriber.prototype.add = function add(sub) { + var _subscription = this._subscription; + if (_subscription) { + _subscription.add(sub); + } else { + _Subscription.prototype.add.call(this, sub); + } + }; + Subscriber.prototype.remove = function remove(sub) { + if (this._subscription) { + this._subscription.remove(sub); + } else { + _Subscription.prototype.remove.call(this, sub); + } + }; + Subscriber.prototype.unsubscribe = function unsubscribe() { + if (this._isUnsubscribed) { + return ; + } else if (this._subscription) { + this._isUnsubscribed = true; + } else { + _Subscription.prototype.unsubscribe.call(this); + } + }; + Subscriber.prototype.next = function next(value) { + if (!this.isUnsubscribed) { + this._next(value); + } + }; + Subscriber.prototype.error = function error(_error2) { + if (!this.isUnsubscribed) { + this._error(_error2); + this.unsubscribe(); + } + }; + Subscriber.prototype.complete = function complete() { + if (!this.isUnsubscribed) { + this._complete(); + this.unsubscribe(); + } + }; + _createClass(Subscriber, [{ + key: 'isUnsubscribed', + get: function get() { + var subscription = this._subscription; + if (subscription) { + return this._isUnsubscribed || subscription.isUnsubscribed; + } else { + return this._isUnsubscribed; + } + }, + set: function set(value) { + var subscription = this._subscription; + if (subscription) { + subscription.isUnsubscribed = Boolean(value); + } else { + this._isUnsubscribed = Boolean(value); + } + } + }]); + return Subscriber; + })(_Subscription3['default']); + exports['default'] = Subscriber; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/util/Symbol_observable", ["@reactivex/rxjs/dist/cjs/util/root"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + var _root = require("@reactivex/rxjs/dist/cjs/util/root"); + if (!_root.root.Symbol) { + _root.root.Symbol = {}; + } + if (!_root.root.Symbol.observable) { + if (typeof _root.root.Symbol['for'] === 'function') { + _root.root.Symbol.observable = _root.root.Symbol['for']('observable'); + } else { + _root.root.Symbol.observable = '@@observable'; + } + } + exports['default'] = _root.root.Symbol.observable; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/date_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/intl", "angular2/src/core/di", "angular2/src/core/metadata", "angular2/src/core/facade/collection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var intl_1 = require("angular2/src/core/facade/intl"); + var di_1 = require("angular2/src/core/di"); + var metadata_1 = require("angular2/src/core/metadata"); + var collection_1 = require("angular2/src/core/facade/collection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var defaultLocale = 'en-US'; + var DatePipe = (function() { + function DatePipe() {} + DatePipe.prototype.transform = function(value, args) { + if (lang_1.isBlank(value)) + return null; + if (!this.supports(value)) { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(DatePipe, value); + } + var pattern = lang_1.isPresent(args) && args.length > 0 ? args[0] : 'mediumDate'; + if (lang_1.isNumber(value)) { + value = lang_1.DateWrapper.fromMillis(value); + } + if (collection_1.StringMapWrapper.contains(DatePipe._ALIASES, pattern)) { + pattern = collection_1.StringMapWrapper.get(DatePipe._ALIASES, pattern); + } + return intl_1.DateFormatter.format(value, defaultLocale, pattern); + }; + DatePipe.prototype.supports = function(obj) { + return lang_1.isDate(obj) || lang_1.isNumber(obj); + }; + DatePipe._ALIASES = { + 'medium': 'yMMMdjms', + 'short': 'yMdjm', + 'fullDate': 'yMMMMEEEEd', + 'longDate': 'yMMMMd', + 'mediumDate': 'yMMMd', + 'shortDate': 'yMd', + 'mediumTime': 'jms', + 'shortTime': 'jm' + }; + DatePipe = __decorate([lang_1.CONST(), metadata_1.Pipe({name: 'date'}), di_1.Injectable(), __metadata('design:paramtypes', [])], DatePipe); + return DatePipe; + })(); + exports.DatePipe = DatePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/default_pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/uppercase_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/facade/lang", "angular2/src/core/di"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var DEFAULT_PIPES_LIST = lang_1.CONST_EXPR([async_pipe_1.AsyncPipe, uppercase_pipe_1.UpperCasePipe, lowercase_pipe_1.LowerCasePipe, json_pipe_1.JsonPipe, slice_pipe_1.SlicePipe, number_pipe_1.DecimalPipe, number_pipe_1.PercentPipe, number_pipe_1.CurrencyPipe, date_pipe_1.DatePipe]); + exports.DEFAULT_PIPES_TOKEN = lang_1.CONST_EXPR(new di_1.OpaqueToken("Default Pipes")); + exports.DEFAULT_PIPES = lang_1.CONST_EXPR(new di_1.Binding(exports.DEFAULT_PIPES_TOKEN, {toValue: DEFAULT_PIPES_LIST})); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/testability/testability", ["angular2/src/core/di", "angular2/src/core/dom/dom_adapter", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/zone/ng_zone", "angular2/src/core/facade/async"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var async_1 = require("angular2/src/core/facade/async"); + var Testability = (function() { + function Testability(_ngZone) { + this._ngZone = _ngZone; + this._pendingCount = 0; + this._callbacks = []; + this._isAngularEventPending = false; + this._watchAngularEvents(_ngZone); + } + Testability.prototype._watchAngularEvents = function(_ngZone) { + var _this = this; + _ngZone.overrideOnTurnStart(function() { + _this._isAngularEventPending = true; + }); + _ngZone.overrideOnEventDone(function() { + _this._isAngularEventPending = false; + _this._runCallbacksIfReady(); + }, true); + }; + Testability.prototype.increasePendingRequestCount = function() { + this._pendingCount += 1; + return this._pendingCount; + }; + Testability.prototype.decreasePendingRequestCount = function() { + this._pendingCount -= 1; + if (this._pendingCount < 0) { + throw new exceptions_1.BaseException('pending async requests below zero'); + } + this._runCallbacksIfReady(); + return this._pendingCount; + }; + Testability.prototype._runCallbacksIfReady = function() { + var _this = this; + if (this._pendingCount != 0 || this._isAngularEventPending) { + return ; + } + async_1.PromiseWrapper.resolve(null).then(function(_) { + while (_this._callbacks.length !== 0) { + (_this._callbacks.pop())(); + } + }); + }; + Testability.prototype.whenStable = function(callback) { + this._callbacks.push(callback); + this._runCallbacksIfReady(); + }; + Testability.prototype.getPendingRequestCount = function() { + return this._pendingCount; + }; + Testability.prototype.isAngularEventPending = function() { + return this._isAngularEventPending; + }; + Testability.prototype.findBindings = function(using, binding, exactMatch) { + return []; + }; + Testability = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [ng_zone_1.NgZone])], Testability); + return Testability; + })(); + exports.Testability = Testability; + var TestabilityRegistry = (function() { + function TestabilityRegistry() { + this._applications = new collection_1.Map(); + testabilityGetter.addToWindow(this); + } + TestabilityRegistry.prototype.registerApplication = function(token, testability) { + this._applications.set(token, testability); + }; + TestabilityRegistry.prototype.getAllTestabilities = function() { + return collection_1.MapWrapper.values(this._applications); + }; + TestabilityRegistry.prototype.findTestabilityInTree = function(elem, findInAncestors) { + if (findInAncestors === void 0) { + findInAncestors = true; + } + if (elem == null) { + return null; + } + if (this._applications.has(elem)) { + return this._applications.get(elem); + } else if (!findInAncestors) { + return null; + } + if (dom_adapter_1.DOM.isShadowRoot(elem)) { + return this.findTestabilityInTree(dom_adapter_1.DOM.getHost(elem)); + } + return this.findTestabilityInTree(dom_adapter_1.DOM.parentElement(elem)); + }; + TestabilityRegistry = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], TestabilityRegistry); + return TestabilityRegistry; + })(); + exports.TestabilityRegistry = TestabilityRegistry; + var NoopGetTestability = (function() { + function NoopGetTestability() {} + NoopGetTestability.prototype.addToWindow = function(registry) {}; + NoopGetTestability = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [])], NoopGetTestability); + return NoopGetTestability; + })(); + function setTestabilityGetter(getter) { + testabilityGetter = getter; + } + exports.setTestabilityGetter = setTestabilityGetter; + var testabilityGetter = lang_1.CONST_EXPR(new NoopGetTestability()); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view", ["angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/interfaces", "angular2/src/core/compiler/element_binder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/dom/util", "angular2/src/core/change_detection/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var element_binder_1 = require("angular2/src/core/compiler/element_binder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var util_1 = require("angular2/src/core/render/dom/util"); + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.DebugContext = interfaces_2.DebugContext; + var REFLECT_PREFIX = 'ng-reflect-'; + var AppProtoViewMergeMapping = (function() { + function AppProtoViewMergeMapping(renderProtoViewMergeMapping) { + this.renderProtoViewRef = renderProtoViewMergeMapping.mergedProtoViewRef; + this.renderFragmentCount = renderProtoViewMergeMapping.fragmentCount; + this.renderElementIndices = renderProtoViewMergeMapping.mappedElementIndices; + this.renderInverseElementIndices = inverseIndexMapping(this.renderElementIndices, renderProtoViewMergeMapping.mappedElementCount); + this.renderTextIndices = renderProtoViewMergeMapping.mappedTextIndices; + this.hostElementIndicesByViewIndex = renderProtoViewMergeMapping.hostElementIndicesByViewIndex; + this.nestedViewIndicesByElementIndex = inverseIndexMapping(this.hostElementIndicesByViewIndex, this.renderElementIndices.length); + this.nestedViewCountByViewIndex = renderProtoViewMergeMapping.nestedViewCountByViewIndex; + } + return AppProtoViewMergeMapping; + })(); + exports.AppProtoViewMergeMapping = AppProtoViewMergeMapping; + function inverseIndexMapping(input, resultLength) { + var result = collection_1.ListWrapper.createGrowableSize(resultLength); + for (var i = 0; i < input.length; i++) { + var value = input[i]; + if (lang_1.isPresent(value)) { + result[input[i]] = i; + } + } + return result; + } + var AppViewContainer = (function() { + function AppViewContainer() { + this.views = []; + } + return AppViewContainer; + })(); + exports.AppViewContainer = AppViewContainer; + var AppView = (function() { + function AppView(renderer, proto, mainMergeMapping, viewOffset, elementOffset, textOffset, protoLocals, render, renderFragment) { + this.renderer = renderer; + this.proto = proto; + this.mainMergeMapping = mainMergeMapping; + this.viewOffset = viewOffset; + this.elementOffset = elementOffset; + this.textOffset = textOffset; + this.render = render; + this.renderFragment = renderFragment; + this.views = null; + this.elementInjectors = null; + this.viewContainers = null; + this.preBuiltObjects = null; + this.changeDetector = null; + this.context = null; + this.ref = new view_ref_1.ViewRef(this); + this.locals = new change_detection_1.Locals(null, collection_1.MapWrapper.clone(protoLocals)); + } + AppView.prototype.init = function(changeDetector, elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers) { + this.changeDetector = changeDetector; + this.elementInjectors = elementInjectors; + this.rootElementInjectors = rootElementInjectors; + this.preBuiltObjects = preBuiltObjects; + this.views = views; + this.elementRefs = elementRefs; + this.viewContainers = viewContainers; + }; + AppView.prototype.setLocal = function(contextName, value) { + if (!this.hydrated()) + throw new exceptions_1.BaseException('Cannot set locals on dehydrated view.'); + if (!this.proto.variableBindings.has(contextName)) { + return ; + } + var templateName = this.proto.variableBindings.get(contextName); + this.locals.set(templateName, value); + }; + AppView.prototype.hydrated = function() { + return lang_1.isPresent(this.context); + }; + AppView.prototype.triggerEventHandlers = function(eventName, eventObj, boundElementIndex) { + var locals = new collection_1.Map(); + locals.set('$event', eventObj); + this.dispatchEvent(boundElementIndex, eventName, locals); + }; + AppView.prototype.notifyOnBinding = function(b, currentValue) { + if (b.isTextNode()) { + this.renderer.setText(this.render, this.mainMergeMapping.renderTextIndices[b.elementIndex + this.textOffset], currentValue); + } else { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + if (b.isElementProperty()) { + this.renderer.setElementProperty(elementRef, b.name, currentValue); + } else if (b.isElementAttribute()) { + this.renderer.setElementAttribute(elementRef, b.name, lang_1.isPresent(currentValue) ? "" + currentValue : null); + } else if (b.isElementClass()) { + this.renderer.setElementClass(elementRef, b.name, currentValue); + } else if (b.isElementStyle()) { + var unit = lang_1.isPresent(b.unit) ? b.unit : ''; + this.renderer.setElementStyle(elementRef, b.name, "" + currentValue + unit); + } else { + throw new exceptions_1.BaseException('Unsupported directive record'); + } + } + }; + AppView.prototype.logBindingUpdate = function(b, value) { + if (b.isDirective() || b.isElementProperty()) { + var elementRef = this.elementRefs[this.elementOffset + b.elementIndex]; + this.renderer.setElementAttribute(elementRef, "" + REFLECT_PREFIX + util_1.camelCaseToDashCase(b.name), "" + value); + } + }; + AppView.prototype.notifyAfterContentChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterContentChecked(); + } + }; + AppView.prototype.notifyAfterViewChecked = function() { + var eiCount = this.proto.elementBinders.length; + var ei = this.elementInjectors; + for (var i = eiCount - 1; i >= 0; i--) { + if (lang_1.isPresent(ei[i + this.elementOffset])) + ei[i + this.elementOffset].afterViewChecked(); + } + }; + AppView.prototype.getDirectiveFor = function(directive) { + var elementInjector = this.elementInjectors[this.elementOffset + directive.elementIndex]; + return elementInjector.getDirectiveAtIndex(directive.directiveIndex); + }; + AppView.prototype.getNestedView = function(boundElementIndex) { + var viewIndex = this.mainMergeMapping.nestedViewIndicesByElementIndex[boundElementIndex]; + return lang_1.isPresent(viewIndex) ? this.views[viewIndex] : null; + }; + AppView.prototype.getHostElement = function() { + var boundElementIndex = this.mainMergeMapping.hostElementIndicesByViewIndex[this.viewOffset]; + return lang_1.isPresent(boundElementIndex) ? this.elementRefs[boundElementIndex] : null; + }; + AppView.prototype.getDebugContext = function(elementIndex, directiveIndex) { + try { + var offsettedIndex = this.elementOffset + elementIndex; + var hasRefForIndex = offsettedIndex < this.elementRefs.length; + var elementRef = hasRefForIndex ? this.elementRefs[this.elementOffset + elementIndex] : null; + var host = this.getHostElement(); + var ei = hasRefForIndex ? this.elementInjectors[this.elementOffset + elementIndex] : null; + var element = lang_1.isPresent(elementRef) ? elementRef.nativeElement : null; + var componentElement = lang_1.isPresent(host) ? host.nativeElement : null; + var directive = lang_1.isPresent(directiveIndex) ? this.getDirectiveFor(directiveIndex) : null; + var injector = lang_1.isPresent(ei) ? ei.getInjector() : null; + return new interfaces_1.DebugContext(element, componentElement, directive, this.context, _localsToStringMap(this.locals), injector); + } catch (e) { + return null; + } + }; + AppView.prototype.getDetectorFor = function(directive) { + var childView = this.getNestedView(this.elementOffset + directive.elementIndex); + return lang_1.isPresent(childView) ? childView.changeDetector : null; + }; + AppView.prototype.invokeElementMethod = function(elementIndex, methodName, args) { + this.renderer.invokeElementMethod(this.elementRefs[elementIndex], methodName, args); + }; + AppView.prototype.dispatchRenderEvent = function(renderElementIndex, eventName, locals) { + var elementRef = this.elementRefs[this.mainMergeMapping.renderInverseElementIndices[renderElementIndex]]; + var view = view_ref_1.internalView(elementRef.parentView); + return view.dispatchEvent(elementRef.boundElementIndex, eventName, locals); + }; + AppView.prototype.dispatchEvent = function(boundElementIndex, eventName, locals) { + try { + if (this.hydrated()) { + return !this.changeDetector.handleEvent(eventName, boundElementIndex - this.elementOffset, new change_detection_1.Locals(this.locals, locals)); + } else { + return true; + } + } catch (e) { + var c = this.getDebugContext(boundElementIndex - this.elementOffset, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector) : null; + throw new EventEvaluationError(eventName, e, e.stack, context); + } + }; + Object.defineProperty(AppView.prototype, "ownBindersCount", { + get: function() { + return this.proto.elementBinders.length; + }, + enumerable: true, + configurable: true + }); + return AppView; + })(); + exports.AppView = AppView; + function _localsToStringMap(locals) { + var res = {}; + var c = locals; + while (lang_1.isPresent(c)) { + res = collection_1.StringMapWrapper.merge(res, collection_1.MapWrapper.toStringMap(c.current)); + c = c.parent; + } + return res; + } + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + } + return _Context; + })(); + var EventEvaluationError = (function(_super) { + __extends(EventEvaluationError, _super); + function EventEvaluationError(eventName, originalException, originalStack, context) { + _super.call(this, "Error during evaluation of \"" + eventName + "\"", originalException, originalStack, context); + } + return EventEvaluationError; + })(exceptions_1.WrappedException); + var AppProtoView = (function() { + function AppProtoView(type, isEmbeddedFragment, render, protoChangeDetector, variableBindings, variableLocations, textBindingCount, pipes) { + var _this = this; + this.type = type; + this.isEmbeddedFragment = isEmbeddedFragment; + this.render = render; + this.protoChangeDetector = protoChangeDetector; + this.variableBindings = variableBindings; + this.variableLocations = variableLocations; + this.textBindingCount = textBindingCount; + this.pipes = pipes; + this.elementBinders = []; + this.protoLocals = new collection_1.Map(); + this.ref = new view_ref_1.ProtoViewRef(this); + if (lang_1.isPresent(variableBindings)) { + collection_1.MapWrapper.forEach(variableBindings, function(templateName, _) { + _this.protoLocals.set(templateName, null); + }); + } + } + AppProtoView.prototype.bindElement = function(parent, distanceToParent, protoElementInjector, componentDirective) { + if (componentDirective === void 0) { + componentDirective = null; + } + var elBinder = new element_binder_1.ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, componentDirective); + this.elementBinders.push(elBinder); + return elBinder; + }; + return AppProtoView; + })(); + exports.AppProtoView = AppProtoView; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/pipes", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/pipes"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var cd = require("angular2/src/core/change_detection/pipes"); + var ProtoPipes = (function() { + function ProtoPipes(bindings) { + var _this = this; + this.config = {}; + bindings.forEach(function(b) { + return _this.config[b.name] = b; + }); + } + ProtoPipes.prototype.get = function(name) { + var binding = this.config[name]; + if (lang_1.isBlank(binding)) + throw new exceptions_1.BaseException("Cannot find pipe '" + name + "'."); + return binding; + }; + return ProtoPipes; + })(); + exports.ProtoPipes = ProtoPipes; + var Pipes = (function() { + function Pipes(proto, injector) { + this.proto = proto; + this.injector = injector; + this._config = {}; + } + Pipes.prototype.get = function(name) { + var cached = collection_1.StringMapWrapper.get(this._config, name); + if (lang_1.isPresent(cached)) + return cached; + var p = this.proto.get(name); + var transform = this.injector.instantiateResolved(p); + var res = new cd.SelectedPipe(transform, p.pure); + if (p.pure) { + collection_1.StringMapWrapper.set(this._config, name, res); + } + return res; + }; + return Pipes; + })(); + exports.Pipes = Pipes; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/directive_lifecycle_reflector", ["angular2/src/core/facade/lang", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function hasLifecycleHook(lcInterface, token) { + if (!(token instanceof lang_1.Type)) + return false; + var proto = token.prototype; + switch (lcInterface) { + case interfaces_1.LifecycleHooks.AfterContentInit: + return !!proto.afterContentInit; + case interfaces_1.LifecycleHooks.AfterContentChecked: + return !!proto.afterContentChecked; + case interfaces_1.LifecycleHooks.AfterViewInit: + return !!proto.afterViewInit; + case interfaces_1.LifecycleHooks.AfterViewChecked: + return !!proto.afterViewChecked; + case interfaces_1.LifecycleHooks.OnChanges: + return !!proto.onChanges; + case interfaces_1.LifecycleHooks.DoCheck: + return !!proto.doCheck; + case interfaces_1.LifecycleHooks.OnDestroy: + return !!proto.onDestroy; + case interfaces_1.LifecycleHooks.OnInit: + return !!proto.onInit; + default: + return false; + } + } + exports.hasLifecycleHook = hasLifecycleHook; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/directive_metadata", ["angular2/src/core/facade/lang", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/selector", "angular2/src/compiler/util", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var api_1 = require("angular2/src/core/render/api"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var util_1 = require("angular2/src/compiler/util"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g; + var CompileTypeMetadata = (function() { + function CompileTypeMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + id = _b.id, + runtime = _b.runtime, + name = _b.name, + moduleId = _b.moduleId; + this.id = id; + this.runtime = runtime; + this.name = name; + this.moduleId = moduleId; + } + CompileTypeMetadata.fromJson = function(data) { + return new CompileTypeMetadata({ + id: data['id'], + name: data['name'], + moduleId: data['moduleId'] + }); + }; + CompileTypeMetadata.prototype.toJson = function() { + return { + 'id': this.id, + 'name': this.name, + 'moduleId': this.moduleId + }; + }; + return CompileTypeMetadata; + })(); + exports.CompileTypeMetadata = CompileTypeMetadata; + var CompileTemplateMetadata = (function() { + function CompileTemplateMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + encapsulation = _b.encapsulation, + template = _b.template, + templateUrl = _b.templateUrl, + styles = _b.styles, + styleUrls = _b.styleUrls, + ngContentSelectors = _b.ngContentSelectors; + this.encapsulation = encapsulation; + this.template = template; + this.templateUrl = templateUrl; + this.styles = lang_1.isPresent(styles) ? styles : []; + this.styleUrls = lang_1.isPresent(styleUrls) ? styleUrls : []; + this.ngContentSelectors = lang_1.isPresent(ngContentSelectors) ? ngContentSelectors : []; + } + CompileTemplateMetadata.fromJson = function(data) { + return new CompileTemplateMetadata({ + encapsulation: lang_1.isPresent(data['encapsulation']) ? api_1.VIEW_ENCAPSULATION_VALUES[data['encapsulation']] : data['encapsulation'], + template: data['template'], + templateUrl: data['templateUrl'], + styles: data['styles'], + styleUrls: data['styleUrls'], + ngContentSelectors: data['ngContentSelectors'] + }); + }; + CompileTemplateMetadata.prototype.toJson = function() { + return { + 'encapsulation': lang_1.isPresent(this.encapsulation) ? lang_1.serializeEnum(this.encapsulation) : this.encapsulation, + 'template': this.template, + 'templateUrl': this.templateUrl, + 'styles': this.styles, + 'styleUrls': this.styleUrls, + 'ngContentSelectors': this.ngContentSelectors + }; + }; + return CompileTemplateMetadata; + })(); + exports.CompileTemplateMetadata = CompileTemplateMetadata; + var CompileDirectiveMetadata = (function() { + function CompileDirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + hostListeners = _b.hostListeners, + hostProperties = _b.hostProperties, + hostAttributes = _b.hostAttributes, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + this.type = type; + this.isComponent = isComponent; + this.dynamicLoadable = dynamicLoadable; + this.selector = selector; + this.exportAs = exportAs; + this.changeDetection = changeDetection; + this.properties = properties; + this.events = events; + this.hostListeners = hostListeners; + this.hostProperties = hostProperties; + this.hostAttributes = hostAttributes; + this.lifecycleHooks = lifecycleHooks; + this.template = template; + } + CompileDirectiveMetadata.create = function(_a) { + var _b = _a === void 0 ? {} : _a, + type = _b.type, + isComponent = _b.isComponent, + dynamicLoadable = _b.dynamicLoadable, + selector = _b.selector, + exportAs = _b.exportAs, + changeDetection = _b.changeDetection, + properties = _b.properties, + events = _b.events, + host = _b.host, + lifecycleHooks = _b.lifecycleHooks, + template = _b.template; + var hostListeners = {}; + var hostProperties = {}; + var hostAttributes = {}; + if (lang_1.isPresent(host)) { + collection_1.StringMapWrapper.forEach(host, function(value, key) { + var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key); + if (lang_1.isBlank(matches)) { + hostAttributes[key] = value; + } else if (lang_1.isPresent(matches[1])) { + hostProperties[matches[1]] = value; + } else if (lang_1.isPresent(matches[2])) { + hostListeners[matches[2]] = value; + } + }); + } + var propsMap = {}; + if (lang_1.isPresent(properties)) { + properties.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + propsMap[parts[0]] = parts[1]; + }); + } + var eventsMap = {}; + if (lang_1.isPresent(events)) { + events.forEach(function(bindConfig) { + var parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]); + eventsMap[parts[0]] = parts[1]; + }); + } + return new CompileDirectiveMetadata({ + type: type, + isComponent: lang_1.normalizeBool(isComponent), + dynamicLoadable: lang_1.normalizeBool(dynamicLoadable), + selector: selector, + exportAs: exportAs, + changeDetection: changeDetection, + properties: propsMap, + events: eventsMap, + hostListeners: hostListeners, + hostProperties: hostProperties, + hostAttributes: hostAttributes, + lifecycleHooks: lang_1.isPresent(lifecycleHooks) ? lifecycleHooks : [], + template: template + }); + }; + CompileDirectiveMetadata.fromJson = function(data) { + return new CompileDirectiveMetadata({ + isComponent: data['isComponent'], + dynamicLoadable: data['dynamicLoadable'], + selector: data['selector'], + exportAs: data['exportAs'], + type: lang_1.isPresent(data['type']) ? CompileTypeMetadata.fromJson(data['type']) : data['type'], + changeDetection: lang_1.isPresent(data['changeDetection']) ? change_detection_1.CHANGE_DECTION_STRATEGY_VALUES[data['changeDetection']] : data['changeDetection'], + properties: data['properties'], + events: data['events'], + hostListeners: data['hostListeners'], + hostProperties: data['hostProperties'], + hostAttributes: data['hostAttributes'], + lifecycleHooks: data['lifecycleHooks'].map(function(hookValue) { + return interfaces_1.LIFECYCLE_HOOKS_VALUES[hookValue]; + }), + template: lang_1.isPresent(data['template']) ? CompileTemplateMetadata.fromJson(data['template']) : data['template'] + }); + }; + CompileDirectiveMetadata.prototype.toJson = function() { + return { + 'isComponent': this.isComponent, + 'dynamicLoadable': this.dynamicLoadable, + 'selector': this.selector, + 'exportAs': this.exportAs, + 'type': lang_1.isPresent(this.type) ? this.type.toJson() : this.type, + 'changeDetection': lang_1.isPresent(this.changeDetection) ? lang_1.serializeEnum(this.changeDetection) : this.changeDetection, + 'properties': this.properties, + 'events': this.events, + 'hostListeners': this.hostListeners, + 'hostProperties': this.hostProperties, + 'hostAttributes': this.hostAttributes, + 'lifecycleHooks': this.lifecycleHooks.map(function(hook) { + return lang_1.serializeEnum(hook); + }), + 'template': lang_1.isPresent(this.template) ? this.template.toJson() : this.template + }; + }; + return CompileDirectiveMetadata; + })(); + exports.CompileDirectiveMetadata = CompileDirectiveMetadata; + function createHostComponentMeta(componentType, componentSelector) { + var template = selector_1.CssSelector.parse(componentSelector)[0].getMatchingElementTemplate(); + return CompileDirectiveMetadata.create({ + type: new CompileTypeMetadata({ + runtime: Object, + id: (componentType.id * -1) - 1, + name: "Host" + componentType.name, + moduleId: componentType.moduleId + }), + template: new CompileTemplateMetadata({ + template: template, + templateUrl: '', + styles: [], + styleUrls: [], + ngContentSelectors: [] + }), + changeDetection: change_detection_1.ChangeDetectionStrategy.Default, + properties: [], + events: [], + host: {}, + lifecycleHooks: [], + isComponent: true, + dynamicLoadable: false, + selector: '*' + }); + } + exports.createHostComponentMeta = createHostComponentMeta; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_definition_factory", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/reflection/reflection", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/template_ast", "angular2/src/core/compiler/interfaces"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + function createChangeDetectorDefinitions(componentType, componentStrategy, genConfig, parsedTemplate) { + var pvVisitors = []; + var visitor = new ProtoViewVisitor(null, pvVisitors, componentStrategy); + template_ast_1.templateVisitAll(visitor, parsedTemplate); + return createChangeDefinitions(pvVisitors, componentType, genConfig); + } + exports.createChangeDetectorDefinitions = createChangeDetectorDefinitions; + var ProtoViewVisitor = (function() { + function ProtoViewVisitor(parent, allVisitors, strategy) { + this.parent = parent; + this.allVisitors = allVisitors; + this.strategy = strategy; + this.boundTextCount = 0; + this.boundElementCount = 0; + this.variableNames = []; + this.bindingRecords = []; + this.eventRecords = []; + this.directiveRecords = []; + this.viewIndex = allVisitors.length; + allVisitors.push(this); + } + ProtoViewVisitor.prototype.visitEmbeddedTemplate = function(ast, context) { + this.boundElementCount++; + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + var childVisitor = new ProtoViewVisitor(this, this.allVisitors, change_detection_1.ChangeDetectionStrategy.Default); + template_ast_1.templateVisitAll(childVisitor, ast.vars); + template_ast_1.templateVisitAll(childVisitor, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitElement = function(ast, context) { + if (ast.isBound()) { + this.boundElementCount++; + } + template_ast_1.templateVisitAll(this, ast.properties, null); + template_ast_1.templateVisitAll(this, ast.events); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + for (var i = 0; i < ast.directives.length; i++) { + ast.directives[i].visit(this, i); + } + template_ast_1.templateVisitAll(this, ast.children); + return null; + }; + ProtoViewVisitor.prototype.visitNgContent = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitVariable = function(ast, context) { + this.variableNames.push(ast.name); + return null; + }; + ProtoViewVisitor.prototype.visitEvent = function(ast, directiveRecord) { + var bindingRecord = lang_1.isPresent(directiveRecord) ? change_detection_1.BindingRecord.createForHostEvent(ast.handler, ast.fullName, directiveRecord) : change_detection_1.BindingRecord.createForEvent(ast.handler, ast.fullName, this.boundElementCount - 1); + this.eventRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitElementProperty = function(ast, directiveRecord) { + var boundElementIndex = this.boundElementCount - 1; + var dirIndex = lang_1.isPresent(directiveRecord) ? directiveRecord.directiveIndex : null; + var bindingRecord; + if (ast.type === template_ast_1.PropertyBindingType.Property) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostProperty(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementProperty(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Attribute) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostAttribute(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementAttribute(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Class) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostClass(dirIndex, ast.value, ast.name) : change_detection_1.BindingRecord.createForElementClass(ast.value, boundElementIndex, ast.name); + } else if (ast.type === template_ast_1.PropertyBindingType.Style) { + bindingRecord = lang_1.isPresent(dirIndex) ? change_detection_1.BindingRecord.createForHostStyle(dirIndex, ast.value, ast.name, ast.unit) : change_detection_1.BindingRecord.createForElementStyle(ast.value, boundElementIndex, ast.name, ast.unit); + } + this.bindingRecords.push(bindingRecord); + return null; + }; + ProtoViewVisitor.prototype.visitAttr = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitBoundText = function(ast, context) { + var boundTextIndex = this.boundTextCount++; + this.bindingRecords.push(change_detection_1.BindingRecord.createForTextNode(ast.value, boundTextIndex)); + return null; + }; + ProtoViewVisitor.prototype.visitText = function(ast, context) { + return null; + }; + ProtoViewVisitor.prototype.visitDirective = function(ast, directiveIndexAsNumber) { + var directiveIndex = new change_detection_1.DirectiveIndex(this.boundElementCount - 1, directiveIndexAsNumber); + var directiveMetadata = ast.directive; + var directiveRecord = new change_detection_1.DirectiveRecord({ + directiveIndex: directiveIndex, + callAfterContentInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentInit) !== -1, + callAfterContentChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterContentChecked) !== -1, + callAfterViewInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewInit) !== -1, + callAfterViewChecked: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.AfterViewChecked) !== -1, + callOnChanges: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnChanges) !== -1, + callDoCheck: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.DoCheck) !== -1, + callOnInit: directiveMetadata.lifecycleHooks.indexOf(interfaces_1.LifecycleHooks.OnInit) !== -1, + changeDetection: directiveMetadata.changeDetection + }); + this.directiveRecords.push(directiveRecord); + template_ast_1.templateVisitAll(this, ast.properties, directiveRecord); + var bindingRecords = this.bindingRecords; + if (directiveRecord.callOnChanges) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnChanges(directiveRecord)); + } + if (directiveRecord.callOnInit) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveOnInit(directiveRecord)); + } + if (directiveRecord.callDoCheck) { + bindingRecords.push(change_detection_1.BindingRecord.createDirectiveDoCheck(directiveRecord)); + } + template_ast_1.templateVisitAll(this, ast.hostProperties, directiveRecord); + template_ast_1.templateVisitAll(this, ast.hostEvents, directiveRecord); + template_ast_1.templateVisitAll(this, ast.exportAsVars); + return null; + }; + ProtoViewVisitor.prototype.visitDirectiveProperty = function(ast, directiveRecord) { + var setter = reflection_1.reflector.setter(ast.directiveName); + this.bindingRecords.push(change_detection_1.BindingRecord.createForDirective(ast.value, ast.directiveName, setter, directiveRecord)); + return null; + }; + return ProtoViewVisitor; + })(); + function createChangeDefinitions(pvVisitors, componentType, genConfig) { + var pvVariableNames = _collectNestedProtoViewsVariableNames(pvVisitors); + return pvVisitors.map(function(pvVisitor) { + var viewType = pvVisitor.viewIndex === 0 ? 'component' : 'embedded'; + var id = _protoViewId(componentType, pvVisitor.viewIndex, viewType); + return new change_detection_1.ChangeDetectorDefinition(id, pvVisitor.strategy, pvVariableNames[pvVisitor.viewIndex], pvVisitor.bindingRecords, pvVisitor.eventRecords, pvVisitor.directiveRecords, genConfig); + }); + } + function _collectNestedProtoViewsVariableNames(pvVisitors) { + var nestedPvVariableNames = collection_1.ListWrapper.createFixedSize(pvVisitors.length); + pvVisitors.forEach(function(pv) { + var parentVariableNames = lang_1.isPresent(pv.parent) ? nestedPvVariableNames[pv.parent.viewIndex] : []; + nestedPvVariableNames[pv.viewIndex] = parentVariableNames.concat(pv.variableNames); + }); + return nestedPvVariableNames; + } + function _protoViewId(hostComponentType, pvIndex, viewType) { + return hostComponentType.name + "_" + viewType + "_" + pvIndex; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/style_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/render/api", "angular2/src/core/render/xhr", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/render/dom/compiler/shadow_css", "angular2/src/core/services/url_resolver", "angular2/src/compiler/style_url_resolver", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var api_1 = require("angular2/src/core/render/api"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var shadow_css_1 = require("angular2/src/core/render/dom/compiler/shadow_css"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var style_url_resolver_1 = require("angular2/src/compiler/style_url_resolver"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var COMPONENT_VARIABLE = '%COMP%'; + var COMPONENT_REGEX = /%COMP%/g; + var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; + var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; + var StyleCompiler = (function() { + function StyleCompiler(_xhr, _urlResolver) { + this._xhr = _xhr; + this._urlResolver = _urlResolver; + this._styleCache = new Map(); + this._shadowCss = new shadow_css_1.ShadowCss(); + } + StyleCompiler.prototype.compileComponentRuntime = function(type, template) { + var styles = template.styles; + var styleAbsUrls = template.styleUrls; + return this._loadStyles(styles, styleAbsUrls, template.encapsulation === api_1.ViewEncapsulation.Emulated).then(function(styles) { + return styles.map(function(style) { + return lang_1.StringWrapper.replaceAll(style, COMPONENT_REGEX, "" + type.id); + }); + }); + }; + StyleCompiler.prototype.compileComponentCodeGen = function(type, template) { + var shim = template.encapsulation === api_1.ViewEncapsulation.Emulated; + var suffix; + if (shim) { + var componentId = "" + type.id; + suffix = util_1.codeGenMapArray(['style'], "style" + util_1.codeGenReplaceAll(COMPONENT_VARIABLE, componentId)); + } else { + suffix = ''; + } + return this._styleCodeGen(template.styles, template.styleUrls, shim, suffix); + }; + StyleCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(this._urlResolver, moduleId, cssText); + return [this._styleModule(moduleId, false, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, false, '')), this._styleModule(moduleId, true, this._styleCodeGen([styleWithImports.style], styleWithImports.styleUrls, true, ''))]; + }; + StyleCompiler.prototype.clearCache = function() { + this._styleCache.clear(); + }; + StyleCompiler.prototype._loadStyles = function(plainStyles, absUrls, encapsulate) { + var _this = this; + var promises = absUrls.map(function(absUrl) { + var cacheKey = "" + absUrl + (encapsulate ? '.shim' : ''); + var result = _this._styleCache.get(cacheKey); + if (lang_1.isBlank(result)) { + result = _this._xhr.get(absUrl).then(function(style) { + var styleWithImports = style_url_resolver_1.resolveStyleUrls(_this._urlResolver, absUrl, style); + return _this._loadStyles([styleWithImports.style], styleWithImports.styleUrls, encapsulate); + }); + _this._styleCache.set(cacheKey, result); + } + return result; + }); + return async_1.PromiseWrapper.all(promises).then(function(nestedStyles) { + var result = plainStyles.map(function(plainStyle) { + return _this._shimIfNeeded(plainStyle, encapsulate); + }); + nestedStyles.forEach(function(styles) { + return styles.forEach(function(style) { + return result.push(style); + }); + }); + return result; + }); + }; + StyleCompiler.prototype._styleCodeGen = function(plainStyles, absUrls, shim, suffix) { + var _this = this; + var expressionSource = "("; + expressionSource += "[" + plainStyles.map(function(plainStyle) { + return util_1.escapeSingleQuoteString(_this._shimIfNeeded(plainStyle, shim)); + }).join(',') + "]"; + for (var i = 0; i < absUrls.length; i++) { + var moduleId = this._shimModuleIdIfNeeded(absUrls[i], shim); + expressionSource += util_1.codeGenConcatArray(source_module_1.moduleRef(moduleId) + "STYLES"); + } + expressionSource += ")" + suffix; + return new source_module_1.SourceExpression([], expressionSource); + }; + StyleCompiler.prototype._styleModule = function(moduleId, shim, expression) { + var moduleSource = "\n " + expression.declarations.join('\n') + "\n " + util_1.codeGenExportVariable('STYLES') + expression.expression + ";\n "; + return new source_module_1.SourceModule(this._shimModuleIdIfNeeded(moduleId, shim), moduleSource); + }; + StyleCompiler.prototype._shimIfNeeded = function(style, shim) { + return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; + }; + StyleCompiler.prototype._shimModuleIdIfNeeded = function(moduleId, shim) { + return shim ? moduleId + ".shim" : moduleId; + }; + StyleCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, url_resolver_1.UrlResolver])], StyleCompiler); + return StyleCompiler; + })(); + exports.StyleCompiler = StyleCompiler; + function shimContentAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimContentAttribute = shimContentAttribute; + function shimHostAttribute(componentId) { + return lang_1.StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, "" + componentId); + } + exports.shimHostAttribute = shimHostAttribute; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/html_parser", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/compiler/html_ast", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var NG_NON_BINDABLE = 'ng-non-bindable'; + var HtmlParser = (function() { + function HtmlParser() {} + HtmlParser.prototype.parse = function(template, sourceInfo) { + var root = dom_adapter_1.DOM.createTemplate(template); + return parseChildNodes(root, sourceInfo); + }; + HtmlParser.prototype.unparse = function(nodes) { + var visitor = new UnparseVisitor(); + var parts = []; + html_ast_1.htmlVisitAll(visitor, nodes, parts); + return parts.join(''); + }; + HtmlParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], HtmlParser); + return HtmlParser; + })(); + exports.HtmlParser = HtmlParser; + function parseText(text, indexInParent, parentSourceInfo) { + var value = dom_adapter_1.DOM.getText(text); + return new html_ast_1.HtmlTextAst(value, parentSourceInfo + " > #text(" + value + "):nth-child(" + indexInParent + ")"); + } + function parseAttr(element, parentSourceInfo, attrName, attrValue) { + return new html_ast_1.HtmlAttrAst(attrName, attrValue, parentSourceInfo + "[" + attrName + "=" + attrValue + "]"); + } + function parseElement(element, indexInParent, parentSourceInfo) { + var nodeName = dom_adapter_1.DOM.nodeName(element).toLowerCase(); + var sourceInfo = parentSourceInfo + " > " + nodeName + ":nth-child(" + indexInParent + ")"; + var attrs = parseAttrs(element, sourceInfo); + var childNodes = parseChildNodes(element, sourceInfo); + return new html_ast_1.HtmlElementAst(nodeName, attrs, childNodes, sourceInfo); + } + function parseAttrs(element, elementSourceInfo) { + var attrMap = dom_adapter_1.DOM.attributeMap(element); + var attrList = []; + attrMap.forEach(function(value, name) { + return attrList.push([name, value]); + }); + attrList.sort(function(entry1, entry2) { + return lang_1.StringWrapper.compare(entry1[0], entry2[0]); + }); + return attrList.map(function(entry) { + return parseAttr(element, elementSourceInfo, entry[0], entry[1]); + }); + } + function parseChildNodes(element, parentSourceInfo) { + var root = dom_adapter_1.DOM.templateAwareRoot(element); + var childNodes = dom_adapter_1.DOM.childNodesAsList(root); + var result = []; + var index = 0; + childNodes.forEach(function(childNode) { + var childResult = null; + if (dom_adapter_1.DOM.isTextNode(childNode)) { + var text = childNode; + childResult = parseText(text, index, parentSourceInfo); + } else if (dom_adapter_1.DOM.isElementNode(childNode)) { + var el = childNode; + childResult = parseElement(el, index, parentSourceInfo); + } + if (lang_1.isPresent(childResult)) { + result.push(childResult); + } + index++; + }); + return result; + } + var UnparseVisitor = (function() { + function UnparseVisitor() {} + UnparseVisitor.prototype.visitElement = function(ast, parts) { + parts.push("<" + ast.name); + var attrs = []; + html_ast_1.htmlVisitAll(this, ast.attrs, attrs); + if (ast.attrs.length > 0) { + parts.push(' '); + parts.push(attrs.join(' ')); + } + parts.push(">"); + html_ast_1.htmlVisitAll(this, ast.children, parts); + parts.push(""); + return null; + }; + UnparseVisitor.prototype.visitAttr = function(ast, parts) { + parts.push(ast.name + "=" + util_1.escapeDoubleQuoteString(ast.value)); + return null; + }; + UnparseVisitor.prototype.visitText = function(ast, parts) { + parts.push(ast.value); + return null; + }; + return UnparseVisitor; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/view_loader", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/xhr", "angular2/src/core/render/dom/compiler/style_inliner", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var style_inliner_1 = require("angular2/src/core/render/dom/compiler/style_inliner"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var profile_1 = require("angular2/src/core/profile/profile"); + var TemplateAndStyles = (function() { + function TemplateAndStyles(template, styles) { + this.template = template; + this.styles = styles; + } + return TemplateAndStyles; + })(); + exports.TemplateAndStyles = TemplateAndStyles; + var ViewLoader = (function() { + function ViewLoader(_xhr, _styleInliner, _styleUrlResolver) { + this._xhr = _xhr; + this._styleInliner = _styleInliner; + this._styleUrlResolver = _styleUrlResolver; + this._cache = new collection_1.Map(); + } + ViewLoader.prototype.load = function(viewDef) { + var _this = this; + var r = profile_1.wtfStartTimeRange('ViewLoader#load()', lang_1.stringify(viewDef.componentId)); + var tplAndStyles = [this._loadHtml(viewDef.template, viewDef.templateAbsUrl, viewDef.componentId)]; + if (lang_1.isPresent(viewDef.styles)) { + viewDef.styles.forEach(function(cssText) { + var textOrPromise = _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + tplAndStyles.push(textOrPromise); + }); + } + if (lang_1.isPresent(viewDef.styleAbsUrls)) { + viewDef.styleAbsUrls.forEach(function(url) { + var promise = _this._loadText(url).then(function(cssText) { + return _this._resolveAndInlineCssText(cssText, viewDef.templateAbsUrl); + }); + tplAndStyles.push(promise); + }); + } + return async_1.PromiseWrapper.all(tplAndStyles).then(function(res) { + var loadedTplAndStyles = res[0]; + var styles = collection_1.ListWrapper.slice(res, 1); + var templateAndStyles = new TemplateAndStyles(loadedTplAndStyles.template, loadedTplAndStyles.styles.concat(styles)); + profile_1.wtfEndTimeRange(r); + return templateAndStyles; + }); + }; + ViewLoader.prototype._loadText = function(url) { + var response = this._cache.get(url); + if (lang_1.isBlank(response)) { + response = async_1.PromiseWrapper.catchError(this._xhr.get(url), function(_) { + return async_1.PromiseWrapper.reject(new exceptions_1.BaseException("Failed to fetch url \"" + url + "\""), null); + }); + this._cache.set(url, response); + } + return response; + }; + ViewLoader.prototype._loadHtml = function(template, templateAbsUrl, componentId) { + var _this = this; + var html; + if (lang_1.isPresent(template)) { + html = async_1.PromiseWrapper.resolve(template); + } else if (lang_1.isPresent(templateAbsUrl)) { + html = this._loadText(templateAbsUrl); + } else { + throw new exceptions_1.BaseException("View should have either the templateUrl or template property set but none was found for the '" + componentId + "' component"); + } + return html.then(function(html) { + var tplEl = dom_adapter_1.DOM.createTemplate(html); + if (lang_1.isPresent(templateAbsUrl) && templateAbsUrl.indexOf("/") >= 0) { + var baseUrl = templateAbsUrl.substring(0, templateAbsUrl.lastIndexOf("/")); + _this._substituteBaseUrl(dom_adapter_1.DOM.content(tplEl), baseUrl); + } + var styleEls = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.content(tplEl), 'STYLE'); + var unresolvedStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl = styleEls[i]; + unresolvedStyles.push(dom_adapter_1.DOM.getText(styleEl)); + dom_adapter_1.DOM.remove(styleEl); + } + var syncStyles = []; + var asyncStyles = []; + for (var i = 0; i < styleEls.length; i++) { + var styleEl_1 = styleEls[i]; + var resolvedStyled = _this._resolveAndInlineCssText(dom_adapter_1.DOM.getText(styleEl_1), templateAbsUrl); + if (lang_1.isPromise(resolvedStyled)) { + asyncStyles.push(resolvedStyled); + } else { + syncStyles.push(resolvedStyled); + } + } + if (asyncStyles.length === 0) { + return async_1.PromiseWrapper.resolve(new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles)); + } else { + return async_1.PromiseWrapper.all(asyncStyles).then(function(loadedStyles) { + return new TemplateAndStyles(dom_adapter_1.DOM.getInnerHTML(tplEl), syncStyles.concat(loadedStyles)); + }); + } + }); + }; + ViewLoader.prototype._substituteBaseUrl = function(element, baseUrl) { + if (dom_adapter_1.DOM.isElementNode(element)) { + var attrs = dom_adapter_1.DOM.attributeMap(element); + collection_1.MapWrapper.forEach(attrs, function(v, k) { + if (lang_1.isPresent(v) && v.indexOf('$baseUrl') >= 0) { + dom_adapter_1.DOM.setAttribute(element, k, lang_1.StringWrapper.replaceAll(v, /\$baseUrl/g, baseUrl)); + } + }); + } + var children = dom_adapter_1.DOM.childNodes(element); + for (var i = 0; i < children.length; i++) { + if (dom_adapter_1.DOM.isElementNode(children[i])) { + this._substituteBaseUrl(children[i], baseUrl); + } + } + }; + ViewLoader.prototype._resolveAndInlineCssText = function(cssText, baseUrl) { + cssText = this._styleUrlResolver.resolveUrls(cssText, baseUrl); + return this._styleInliner.inlineImports(cssText, baseUrl); + }; + ViewLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [xhr_1.XHR, style_inliner_1.StyleInliner, style_url_resolver_1.StyleUrlResolver])], ViewLoader); + return ViewLoader; + })(); + exports.ViewLoader = ViewLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/shared_styles_host", ["angular2/src/core/dom/dom_adapter", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var SharedStylesHost = (function() { + function SharedStylesHost() { + this._styles = []; + this._stylesSet = new Set(); + } + SharedStylesHost.prototype.addStyles = function(styles) { + var _this = this; + var additions = []; + styles.forEach(function(style) { + if (!collection_1.SetWrapper.has(_this._stylesSet, style)) { + _this._stylesSet.add(style); + _this._styles.push(style); + additions.push(style); + } + }); + this.onStylesAdded(additions); + }; + SharedStylesHost.prototype.onStylesAdded = function(additions) {}; + SharedStylesHost.prototype.getAllStyles = function() { + return this._styles; + }; + SharedStylesHost = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], SharedStylesHost); + return SharedStylesHost; + })(); + exports.SharedStylesHost = SharedStylesHost; + var DomSharedStylesHost = (function(_super) { + __extends(DomSharedStylesHost, _super); + function DomSharedStylesHost(doc) { + _super.call(this); + this._hostNodes = new Set(); + this._hostNodes.add(doc.head); + } + DomSharedStylesHost.prototype._addStylesToHost = function(styles, host) { + for (var i = 0; i < styles.length; i++) { + var style = styles[i]; + dom_adapter_1.DOM.appendChild(host, dom_adapter_1.DOM.createStyleElement(style)); + } + }; + DomSharedStylesHost.prototype.addHost = function(hostNode) { + this._addStylesToHost(this._styles, hostNode); + this._hostNodes.add(hostNode); + }; + DomSharedStylesHost.prototype.removeHost = function(hostNode) { + collection_1.SetWrapper.delete(this._hostNodes, hostNode); + }; + DomSharedStylesHost.prototype.onStylesAdded = function(additions) { + var _this = this; + this._hostNodes.forEach(function(hostNode) { + _this._addStylesToHost(additions, hostNode); + }); + }; + DomSharedStylesHost = __decorate([di_1.Injectable(), __param(0, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [Object])], DomSharedStylesHost); + return DomSharedStylesHost; + })(SharedStylesHost); + exports.DomSharedStylesHost = DomSharedStylesHost; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/view/proto_view_builder", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/element_binder", "angular2/src/core/render/api", "angular2/src/core/render/dom/util", "angular2/src/core/render/event_config"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var element_binder_1 = require("angular2/src/core/render/dom/view/element_binder"); + var api_1 = require("angular2/src/core/render/api"); + var util_1 = require("angular2/src/core/render/dom/util"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var ProtoViewBuilder = (function() { + function ProtoViewBuilder(rootElement, type, viewEncapsulation) { + this.rootElement = rootElement; + this.type = type; + this.viewEncapsulation = viewEncapsulation; + this.variableBindings = new Map(); + this.elements = []; + this.rootTextBindings = new Map(); + this.ngContentCount = 0; + this.hostAttributes = new Map(); + } + ProtoViewBuilder.prototype.bindElement = function(element, description) { + if (description === void 0) { + description = null; + } + var builder = new ElementBinderBuilder(this.elements.length, element, description); + this.elements.push(builder); + dom_adapter_1.DOM.addClass(element, util_1.NG_BINDING_CLASS); + return builder; + }; + ProtoViewBuilder.prototype.bindVariable = function(name, value) { + this.variableBindings.set(value, name); + }; + ProtoViewBuilder.prototype.bindRootText = function(textNode, expression) { + this.rootTextBindings.set(textNode, expression); + }; + ProtoViewBuilder.prototype.bindNgContent = function() { + this.ngContentCount++; + }; + ProtoViewBuilder.prototype.setHostAttribute = function(name, value) { + this.hostAttributes.set(name, value); + }; + ProtoViewBuilder.prototype.build = function(schemaRegistry, templateCloner) { + var domElementBinders = []; + var apiElementBinders = []; + var textNodeExpressions = []; + var rootTextNodeIndices = []; + var transitiveNgContentCount = this.ngContentCount; + util_1.queryBoundTextNodeIndices(dom_adapter_1.DOM.content(this.rootElement), this.rootTextBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + rootTextNodeIndices.push(nodeIndex); + }); + collection_1.ListWrapper.forEach(this.elements, function(ebb) { + var directiveTemplatePropertyNames = new collection_1.Set(); + var apiDirectiveBinders = collection_1.ListWrapper.map(ebb.directives, function(dbb) { + ebb.eventBuilder.merge(dbb.eventBuilder); + collection_1.ListWrapper.forEach(dbb.templatePropertyNames, function(name) { + return directiveTemplatePropertyNames.add(name); + }); + return new api_1.DirectiveBinder({ + directiveIndex: dbb.directiveIndex, + propertyBindings: dbb.propertyBindings, + eventBindings: dbb.eventBindings, + hostPropertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, true, dbb.hostPropertyBindings, null) + }); + }); + var nestedProtoView = lang_1.isPresent(ebb.nestedProtoView) ? ebb.nestedProtoView.build(schemaRegistry, templateCloner) : null; + if (lang_1.isPresent(nestedProtoView)) { + transitiveNgContentCount += nestedProtoView.transitiveNgContentCount; + } + var parentIndex = lang_1.isPresent(ebb.parent) ? ebb.parent.index : -1; + var textNodeIndices = []; + util_1.queryBoundTextNodeIndices(ebb.element, ebb.textBindings, function(node, nodeIndex, expression) { + textNodeExpressions.push(expression); + textNodeIndices.push(nodeIndex); + }); + apiElementBinders.push(new api_1.RenderElementBinder({ + index: ebb.index, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + directives: apiDirectiveBinders, + nestedProtoView: nestedProtoView, + propertyBindings: buildElementPropertyBindings(schemaRegistry, ebb.element, lang_1.isPresent(ebb.componentId), ebb.propertyBindings, directiveTemplatePropertyNames), + variableBindings: ebb.variableBindings, + eventBindings: ebb.eventBindings, + readAttributes: ebb.readAttributes + })); + domElementBinders.push(new element_binder_1.DomElementBinder({ + textNodeIndices: textNodeIndices, + hasNestedProtoView: lang_1.isPresent(nestedProtoView) || lang_1.isPresent(ebb.componentId), + hasNativeShadowRoot: false, + eventLocals: new change_detection_1.LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents() + })); + }); + var rootNodeCount = dom_adapter_1.DOM.childNodes(dom_adapter_1.DOM.content(this.rootElement)).length; + return new api_1.ProtoViewDto({ + render: new proto_view_1.DomProtoViewRef(proto_view_1.DomProtoView.create(templateCloner, this.type, this.rootElement, this.viewEncapsulation, [rootNodeCount], rootTextNodeIndices, domElementBinders, this.hostAttributes)), + type: this.type, + elementBinders: apiElementBinders, + variableBindings: this.variableBindings, + textBindings: textNodeExpressions, + transitiveNgContentCount: transitiveNgContentCount + }); + }; + return ProtoViewBuilder; + })(); + exports.ProtoViewBuilder = ProtoViewBuilder; + var ElementBinderBuilder = (function() { + function ElementBinderBuilder(index, element, description) { + this.index = index; + this.element = element; + this.parent = null; + this.distanceToParent = 0; + this.directives = []; + this.nestedProtoView = null; + this.propertyBindings = new Map(); + this.variableBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + this.textBindings = new Map(); + this.readAttributes = new Map(); + this.componentId = null; + } + ElementBinderBuilder.prototype.setParent = function(parent, distanceToParent) { + this.parent = parent; + if (lang_1.isPresent(parent)) { + this.distanceToParent = distanceToParent; + } + return this; + }; + ElementBinderBuilder.prototype.readAttribute = function(attrName) { + if (lang_1.isBlank(this.readAttributes.get(attrName))) { + this.readAttributes.set(attrName, dom_adapter_1.DOM.getAttribute(this.element, attrName)); + } + }; + ElementBinderBuilder.prototype.bindDirective = function(directiveIndex) { + var directive = new DirectiveBuilder(directiveIndex); + this.directives.push(directive); + return directive; + }; + ElementBinderBuilder.prototype.bindNestedProtoView = function(rootElement) { + if (lang_1.isPresent(this.nestedProtoView)) { + throw new exceptions_1.BaseException('Only one nested view per element is allowed'); + } + this.nestedProtoView = new ProtoViewBuilder(rootElement, api_1.ViewType.EMBEDDED, api_1.ViewEncapsulation.None); + return this.nestedProtoView; + }; + ElementBinderBuilder.prototype.bindProperty = function(name, expression) { + this.propertyBindings.set(name, expression); + }; + ElementBinderBuilder.prototype.bindVariable = function(name, value) { + if (lang_1.isPresent(this.nestedProtoView)) { + this.nestedProtoView.bindVariable(name, value); + } else { + this.variableBindings.set(value, name); + } + }; + ElementBinderBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + ElementBinderBuilder.prototype.bindText = function(textNode, expression) { + this.textBindings.set(textNode, expression); + }; + ElementBinderBuilder.prototype.setComponentId = function(componentId) { + this.componentId = componentId; + }; + return ElementBinderBuilder; + })(); + exports.ElementBinderBuilder = ElementBinderBuilder; + var DirectiveBuilder = (function() { + function DirectiveBuilder(directiveIndex) { + this.directiveIndex = directiveIndex; + this.propertyBindings = new Map(); + this.templatePropertyNames = []; + this.hostPropertyBindings = new Map(); + this.eventBindings = []; + this.eventBuilder = new EventBuilder(); + } + DirectiveBuilder.prototype.bindProperty = function(name, expression, elProp) { + this.propertyBindings.set(name, expression); + if (lang_1.isPresent(elProp)) { + this.templatePropertyNames.push(elProp); + } + }; + DirectiveBuilder.prototype.bindHostProperty = function(name, expression) { + this.hostPropertyBindings.set(name, expression); + }; + DirectiveBuilder.prototype.bindEvent = function(name, expression, target) { + if (target === void 0) { + target = null; + } + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); + }; + return DirectiveBuilder; + })(); + exports.DirectiveBuilder = DirectiveBuilder; + var EventBuilder = (function(_super) { + __extends(EventBuilder, _super); + function EventBuilder() { + _super.call(this); + this.locals = []; + this.localEvents = []; + this.globalEvents = []; + this._implicitReceiver = new change_detection_1.ImplicitReceiver(); + } + EventBuilder.prototype.add = function(name, source, target) { + var adjustedAst = source.ast; + var fullName = lang_1.isPresent(target) ? target + event_config_1.EVENT_TARGET_SEPARATOR + name : name; + var result = new api_1.EventBinding(fullName, new change_detection_1.ASTWithSource(adjustedAst, source.source, source.location)); + var event = new element_binder_1.Event(name, target, fullName); + if (lang_1.isBlank(target)) { + this.localEvents.push(event); + } else { + this.globalEvents.push(event); + } + return result; + }; + EventBuilder.prototype.visitPropertyRead = function(ast) { + var isEventAccess = false; + var current = ast; + while (!isEventAccess && (current instanceof change_detection_1.PropertyRead)) { + var am = current; + if (am.name == '$event') { + isEventAccess = true; + } + current = am.receiver; + } + if (isEventAccess) { + this.locals.push(ast); + var index = this.locals.length - 1; + return new change_detection_1.PropertyRead(this._implicitReceiver, "" + index, function(arr) { + return arr[index]; + }); + } else { + return ast; + } + }; + EventBuilder.prototype.buildEventLocals = function() { + return this.locals; + }; + EventBuilder.prototype.buildLocalEvents = function() { + return this.localEvents; + }; + EventBuilder.prototype.buildGlobalEvents = function() { + return this.globalEvents; + }; + EventBuilder.prototype.merge = function(eventBuilder) { + this._merge(this.localEvents, eventBuilder.localEvents); + this._merge(this.globalEvents, eventBuilder.globalEvents); + this.locals.concat(eventBuilder.locals); + }; + EventBuilder.prototype._merge = function(host, tobeAdded) { + var names = []; + for (var i = 0; i < host.length; i++) { + names.push(host[i].fullName); + } + for (var j = 0; j < tobeAdded.length; j++) { + if (!collection_1.ListWrapper.contains(names, tobeAdded[j].fullName)) { + host.push(tobeAdded[j]); + } + } + }; + return EventBuilder; + })(change_detection_1.AstTransformer); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + function buildElementPropertyBindings(schemaRegistry, protoElement, isNgComponent, bindingsInTemplate, directiveTemplatePropertyNames) { + var propertyBindings = []; + collection_1.MapWrapper.forEach(bindingsInTemplate, function(ast, propertyNameInTemplate) { + var propertyBinding = createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate); + if (lang_1.isPresent(directiveTemplatePropertyNames) && collection_1.SetWrapper.has(directiveTemplatePropertyNames, propertyNameInTemplate)) {} else if (isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, propertyBinding)) { + propertyBindings.push(propertyBinding); + } else { + var exMsg = "Can't bind to '" + propertyNameInTemplate + "' since it isn't a known property of the '<" + dom_adapter_1.DOM.tagName(protoElement).toLowerCase() + ">' element"; + if (lang_1.isPresent(directiveTemplatePropertyNames)) { + exMsg += ' and there are no matching directives with a corresponding property'; + } + throw new exceptions_1.BaseException(exMsg); + } + }); + return propertyBindings; + } + function isValidElementPropertyBinding(schemaRegistry, protoElement, isNgComponent, binding) { + if (binding.type === api_1.PropertyBindingType.PROPERTY) { + if (!isNgComponent) { + return schemaRegistry.hasProperty(dom_adapter_1.DOM.tagName(protoElement), binding.property); + } else { + return dom_adapter_1.DOM.hasProperty(protoElement, binding.property); + } + } + return true; + } + function createElementPropertyBinding(schemaRegistry, ast, propertyNameInTemplate) { + var parts = propertyNameInTemplate.split('.'); + if (parts.length === 1) { + var propName = schemaRegistry.getMappedPropName(parts[0]); + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.PROPERTY, ast, propName); + } else if (parts[0] == ATTRIBUTE_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.ATTRIBUTE, ast, parts[1]); + } else if (parts[0] == CLASS_PREFIX) { + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.CLASS, ast, util_1.camelCaseToDashCase(parts[1])); + } else if (parts[0] == STYLE_PREFIX) { + var unit = parts.length > 2 ? parts[2] : null; + return new api_1.ElementPropertyBinding(api_1.PropertyBindingType.STYLE, ast, parts[1], unit); + } else { + throw new exceptions_1.BaseException("Invalid property name " + propertyNameInTemplate); + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_step_factory", ["angular2/src/core/render/dom/compiler/property_binding_parser", "angular2/src/core/render/dom/compiler/text_interpolation_parser", "angular2/src/core/render/dom/compiler/directive_parser", "angular2/src/core/render/dom/compiler/view_splitter", "angular2/src/core/render/dom/compiler/style_encapsulator"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var property_binding_parser_1 = require("angular2/src/core/render/dom/compiler/property_binding_parser"); + var text_interpolation_parser_1 = require("angular2/src/core/render/dom/compiler/text_interpolation_parser"); + var directive_parser_1 = require("angular2/src/core/render/dom/compiler/directive_parser"); + var view_splitter_1 = require("angular2/src/core/render/dom/compiler/view_splitter"); + var style_encapsulator_1 = require("angular2/src/core/render/dom/compiler/style_encapsulator"); + var CompileStepFactory = (function() { + function CompileStepFactory() {} + CompileStepFactory.prototype.createSteps = function(view) { + return null; + }; + return CompileStepFactory; + })(); + exports.CompileStepFactory = CompileStepFactory; + var DefaultStepFactory = (function(_super) { + __extends(DefaultStepFactory, _super); + function DefaultStepFactory(_parser, _appId) { + _super.call(this); + this._parser = _parser; + this._appId = _appId; + this._componentUIDsCache = new Map(); + } + DefaultStepFactory.prototype.createSteps = function(view) { + return [new view_splitter_1.ViewSplitter(this._parser), new property_binding_parser_1.PropertyBindingParser(this._parser), new directive_parser_1.DirectiveParser(this._parser, view.directives), new text_interpolation_parser_1.TextInterpolationParser(this._parser), new style_encapsulator_1.StyleEncapsulator(this._appId, view, this._componentUIDsCache)]; + }; + return DefaultStepFactory; + })(CompileStepFactory); + exports.DefaultStepFactory = DefaultStepFactory; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation", ["angular2/src/core/facade/lang", "angular2/src/core/facade/math", "angular2/src/core/render/dom/util", "angular2/src/core/facade/collection", "angular2/src/core/dom/dom_adapter"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var math_1 = require("angular2/src/core/facade/math"); + var util_1 = require("angular2/src/core/render/dom/util"); + var collection_1 = require("angular2/src/core/facade/collection"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var Animation = (function() { + function Animation(element, data, browserDetails) { + var _this = this; + this.element = element; + this.data = data; + this.browserDetails = browserDetails; + this.callbacks = []; + this.eventClearFunctions = []; + this.completed = false; + this._stringPrefix = ''; + this.startTime = lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now()); + this._stringPrefix = dom_adapter_1.DOM.getAnimationPrefix(); + this.setup(); + this.wait(function(timestamp) { + return _this.start(); + }); + } + Object.defineProperty(Animation.prototype, "totalTime", { + get: function() { + var delay = this.computedDelay != null ? this.computedDelay : 0; + var duration = this.computedDuration != null ? this.computedDuration : 0; + return delay + duration; + }, + enumerable: true, + configurable: true + }); + Animation.prototype.wait = function(callback) { + this.browserDetails.raf(callback, 2); + }; + Animation.prototype.setup = function() { + if (this.data.fromStyles != null) + this.applyStyles(this.data.fromStyles); + if (this.data.duration != null) + this.applyStyles({'transitionDuration': this.data.duration.toString() + 'ms'}); + if (this.data.delay != null) + this.applyStyles({'transitionDelay': this.data.delay.toString() + 'ms'}); + }; + Animation.prototype.start = function() { + this.addClasses(this.data.classesToAdd); + this.addClasses(this.data.animationClasses); + this.removeClasses(this.data.classesToRemove); + if (this.data.toStyles != null) + this.applyStyles(this.data.toStyles); + var computedStyles = dom_adapter_1.DOM.getComputedStyle(this.element); + this.computedDelay = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-delay')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-delay'))); + this.computedDuration = math_1.Math.max(this.parseDurationString(computedStyles.getPropertyValue(this._stringPrefix + 'transition-duration')), this.parseDurationString(this.element.style.getPropertyValue(this._stringPrefix + 'transition-duration'))); + this.addEvents(); + }; + Animation.prototype.applyStyles = function(styles) { + var _this = this; + collection_1.StringMapWrapper.forEach(styles, function(value, key) { + var dashCaseKey = util_1.camelCaseToDashCase(key); + if (lang_1.isPresent(dom_adapter_1.DOM.getStyle(_this.element, dashCaseKey))) { + dom_adapter_1.DOM.setStyle(_this.element, dashCaseKey, value.toString()); + } else { + dom_adapter_1.DOM.setStyle(_this.element, _this._stringPrefix + dashCaseKey, value.toString()); + } + }); + }; + Animation.prototype.addClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.addClass(this.element, classes[i]); + }; + Animation.prototype.removeClasses = function(classes) { + for (var i = 0, + len = classes.length; i < len; i++) + dom_adapter_1.DOM.removeClass(this.element, classes[i]); + }; + Animation.prototype.addEvents = function() { + var _this = this; + if (this.totalTime > 0) { + this.eventClearFunctions.push(dom_adapter_1.DOM.onAndCancel(this.element, dom_adapter_1.DOM.getTransitionEnd(), function(event) { + return _this.handleAnimationEvent(event); + })); + } else { + this.handleAnimationCompleted(); + } + }; + Animation.prototype.handleAnimationEvent = function(event) { + var elapsedTime = math_1.Math.round(event.elapsedTime * 1000); + if (!this.browserDetails.elapsedTimeIncludesDelay) + elapsedTime += this.computedDelay; + event.stopPropagation(); + if (elapsedTime >= this.totalTime) + this.handleAnimationCompleted(); + }; + Animation.prototype.handleAnimationCompleted = function() { + this.removeClasses(this.data.animationClasses); + this.callbacks.forEach(function(callback) { + return callback(); + }); + this.callbacks = []; + this.eventClearFunctions.forEach(function(fn) { + return fn(); + }); + this.eventClearFunctions = []; + this.completed = true; + }; + Animation.prototype.onComplete = function(callback) { + if (this.completed) { + callback(); + } else { + this.callbacks.push(callback); + } + return this; + }; + Animation.prototype.parseDurationString = function(duration) { + var maxValue = 0; + if (duration == null || duration.length < 2) { + return maxValue; + } else if (duration.substring(duration.length - 2) == 'ms') { + var value = lang_1.NumberWrapper.parseInt(this.stripLetters(duration), 10); + if (value > maxValue) + maxValue = value; + } else if (duration.substring(duration.length - 1) == 's') { + var ms = lang_1.NumberWrapper.parseFloat(this.stripLetters(duration)) * 1000; + var value = math_1.Math.floor(ms); + if (value > maxValue) + maxValue = value; + } + return maxValue; + }; + Animation.prototype.stripLetters = function(str) { + return lang_1.StringWrapper.replaceAll(str, lang_1.RegExpWrapper.create('[^0-9]+$', ''), ''); + }; + return Animation; + })(); + exports.Animation = Animation; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives/ng_class", ["angular2/src/core/facade/lang", "angular2/src/core/metadata", "angular2/src/core/compiler", "angular2/src/core/change_detection", "angular2/src/core/render", "angular2/src/core/facade/collection"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/metadata"); + var compiler_1 = require("angular2/src/core/compiler"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var render_1 = require("angular2/src/core/render"); + var collection_1 = require("angular2/src/core/facade/collection"); + var NgClass = (function() { + function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { + this._iterableDiffers = _iterableDiffers; + this._keyValueDiffers = _keyValueDiffers; + this._ngEl = _ngEl; + this._renderer = _renderer; + this._initialClasses = []; + } + Object.defineProperty(NgClass.prototype, "initialClasses", { + set: function(v) { + this._applyInitialClasses(true); + this._initialClasses = lang_1.isPresent(v) && lang_1.isString(v) ? v.split(' ') : []; + this._applyInitialClasses(false); + this._applyClasses(this._rawClass, false); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgClass.prototype, "rawClass", { + set: function(v) { + this._cleanupClasses(this._rawClass); + if (lang_1.isString(v)) { + v = v.split(' '); + } + this._rawClass = v; + if (lang_1.isPresent(v)) { + if (collection_1.isListLikeIterable(v)) { + this._differ = this._iterableDiffers.find(v).create(null); + this._mode = 'iterable'; + } else { + this._differ = this._keyValueDiffers.find(v).create(null); + this._mode = 'keyValue'; + } + } else { + this._differ = null; + } + }, + enumerable: true, + configurable: true + }); + NgClass.prototype.doCheck = function() { + if (lang_1.isPresent(this._differ)) { + var changes = this._differ.diff(this._rawClass); + if (lang_1.isPresent(changes)) { + if (this._mode == 'iterable') { + this._applyIterableChanges(changes); + } else { + this._applyKeyValueChanges(changes); + } + } + } + }; + NgClass.prototype.onDestroy = function() { + this._cleanupClasses(this._rawClass); + }; + NgClass.prototype._cleanupClasses = function(rawClassVal) { + this._applyClasses(rawClassVal, true); + this._applyInitialClasses(false); + }; + NgClass.prototype._applyKeyValueChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachChangedItem(function(record) { + _this._toggleClass(record.key, record.currentValue); + }); + changes.forEachRemovedItem(function(record) { + if (record.previousValue) { + _this._toggleClass(record.key, false); + } + }); + }; + NgClass.prototype._applyIterableChanges = function(changes) { + var _this = this; + changes.forEachAddedItem(function(record) { + _this._toggleClass(record.item, true); + }); + changes.forEachRemovedItem(function(record) { + _this._toggleClass(record.item, false); + }); + }; + NgClass.prototype._applyInitialClasses = function(isCleanup) { + var _this = this; + collection_1.ListWrapper.forEach(this._initialClasses, function(className) { + _this._toggleClass(className, !isCleanup); + }); + }; + NgClass.prototype._applyClasses = function(rawClassVal, isCleanup) { + var _this = this; + if (lang_1.isPresent(rawClassVal)) { + if (collection_1.isListLikeIterable(rawClassVal)) { + collection_1.ListWrapper.forEach(rawClassVal, function(className) { + return _this._toggleClass(className, !isCleanup); + }); + } else { + collection_1.StringMapWrapper.forEach(rawClassVal, function(expVal, className) { + if (expVal) + _this._toggleClass(className, !isCleanup); + }); + } + } + }; + NgClass.prototype._toggleClass = function(className, enabled) { + className = className.trim(); + if (className.length > 0) { + this._renderer.setElementClass(this._ngEl, className, enabled); + } + }; + NgClass = __decorate([metadata_1.Directive({ + selector: '[ng-class]', + properties: ['rawClass: ng-class', 'initialClasses: class'] + }), __metadata('design:paramtypes', [change_detection_1.IterableDiffers, change_detection_1.KeyValueDiffers, compiler_1.ElementRef, render_1.Renderer])], NgClass); + return NgClass; + })(); + exports.NgClass = NgClass; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/model", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var validators_1 = require("angular2/src/core/forms/validators"); + exports.VALID = "VALID"; + exports.INVALID = "INVALID"; + function isControl(control) { + return control instanceof AbstractControl; + } + exports.isControl = isControl; + function _find(control, path) { + if (lang_1.isBlank(path)) + return null; + if (!(path instanceof Array)) { + path = path.split("/"); + } + if (path instanceof Array && collection_1.ListWrapper.isEmpty(path)) + return null; + return collection_1.ListWrapper.reduce(path, function(v, name) { + if (v instanceof ControlGroup) { + return lang_1.isPresent(v.controls[name]) ? v.controls[name] : null; + } else if (v instanceof ControlArray) { + var index = name; + return lang_1.isPresent(v.at(index)) ? v.at(index) : null; + } else { + return null; + } + }, control); + } + var AbstractControl = (function() { + function AbstractControl(validator) { + this.validator = validator; + this._pristine = true; + this._touched = false; + } + Object.defineProperty(AbstractControl.prototype, "value", { + get: function() { + return this._value; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "status", { + get: function() { + return this._status; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valid", { + get: function() { + return this._status === exports.VALID; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "errors", { + get: function() { + return this._errors; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "pristine", { + get: function() { + return this._pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "dirty", { + get: function() { + return !this.pristine; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "touched", { + get: function() { + return this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "untouched", { + get: function() { + return !this._touched; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AbstractControl.prototype, "valueChanges", { + get: function() { + return this._valueChanges; + }, + enumerable: true, + configurable: true + }); + AbstractControl.prototype.markAsTouched = function() { + this._touched = true; + }; + AbstractControl.prototype.markAsDirty = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._pristine = false; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.markAsDirty({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.setParent = function(parent) { + this._parent = parent; + }; + AbstractControl.prototype.updateValidity = function(_a) { + var onlySelf = (_a === void 0 ? {} : _a).onlySelf; + onlySelf = lang_1.normalizeBool(onlySelf); + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValidity({onlySelf: onlySelf}); + } + }; + AbstractControl.prototype.updateValueAndValidity = function(_a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent; + onlySelf = lang_1.normalizeBool(onlySelf); + emitEvent = lang_1.isPresent(emitEvent) ? emitEvent : true; + this._updateValue(); + if (emitEvent) { + async_1.ObservableWrapper.callNext(this._valueChanges, this._value); + } + this._errors = this.validator(this); + this._status = lang_1.isPresent(this._errors) ? exports.INVALID : exports.VALID; + if (lang_1.isPresent(this._parent) && !onlySelf) { + this._parent.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + } + }; + AbstractControl.prototype.find = function(path) { + return _find(this, path); + }; + AbstractControl.prototype.getError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + var control = lang_1.isPresent(path) && !collection_1.ListWrapper.isEmpty(path) ? this.find(path) : this; + if (lang_1.isPresent(control) && lang_1.isPresent(control._errors)) { + return collection_1.StringMapWrapper.get(control._errors, errorCode); + } else { + return null; + } + }; + AbstractControl.prototype.hasError = function(errorCode, path) { + if (path === void 0) { + path = null; + } + return lang_1.isPresent(this.getError(errorCode, path)); + }; + AbstractControl.prototype._updateValue = function() {}; + return AbstractControl; + })(); + exports.AbstractControl = AbstractControl; + var Control = (function(_super) { + __extends(Control, _super); + function Control(value, validator) { + if (value === void 0) { + value = null; + } + if (validator === void 0) { + validator = validators_1.Validators.nullValidator; + } + _super.call(this, validator); + this._value = value; + this.updateValidity({onlySelf: true}); + this._valueChanges = new async_1.EventEmitter(); + } + Control.prototype.updateValue = function(value, _a) { + var _b = _a === void 0 ? {} : _a, + onlySelf = _b.onlySelf, + emitEvent = _b.emitEvent, + emitModelToViewChange = _b.emitModelToViewChange; + emitModelToViewChange = lang_1.isPresent(emitModelToViewChange) ? emitModelToViewChange : true; + this._value = value; + if (lang_1.isPresent(this._onChange) && emitModelToViewChange) + this._onChange(this._value); + this.updateValueAndValidity({ + onlySelf: onlySelf, + emitEvent: emitEvent + }); + }; + Control.prototype.registerOnChange = function(fn) { + this._onChange = fn; + }; + return Control; + })(AbstractControl); + exports.Control = Control; + var ControlGroup = (function(_super) { + __extends(ControlGroup, _super); + function ControlGroup(controls, optionals, validator) { + if (optionals === void 0) { + optionals = null; + } + if (validator === void 0) { + validator = validators_1.Validators.group; + } + _super.call(this, validator); + this.controls = controls; + this._optionals = lang_1.isPresent(optionals) ? optionals : {}; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._value = this._reduceValue(); + this.updateValidity({onlySelf: true}); + } + ControlGroup.prototype.addControl = function(name, control) { + this.controls[name] = control; + control.setParent(this); + }; + ControlGroup.prototype.removeControl = function(name) { + collection_1.StringMapWrapper.delete(this.controls, name); + }; + ControlGroup.prototype.include = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, true); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.exclude = function(controlName) { + collection_1.StringMapWrapper.set(this._optionals, controlName, false); + this.updateValueAndValidity(); + }; + ControlGroup.prototype.contains = function(controlName) { + var c = collection_1.StringMapWrapper.contains(this.controls, controlName); + return c && this._included(controlName); + }; + ControlGroup.prototype._setParentForControls = function() { + var _this = this; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + control.setParent(_this); + }); + }; + ControlGroup.prototype._updateValue = function() { + this._value = this._reduceValue(); + }; + ControlGroup.prototype._reduceValue = function() { + return this._reduceChildren({}, function(acc, control, name) { + acc[name] = control.value; + return acc; + }); + }; + ControlGroup.prototype._reduceChildren = function(initValue, fn) { + var _this = this; + var res = initValue; + collection_1.StringMapWrapper.forEach(this.controls, function(control, name) { + if (_this._included(name)) { + res = fn(res, control, name); + } + }); + return res; + }; + ControlGroup.prototype._included = function(controlName) { + var isOptional = collection_1.StringMapWrapper.contains(this._optionals, controlName); + return !isOptional || collection_1.StringMapWrapper.get(this._optionals, controlName); + }; + return ControlGroup; + })(AbstractControl); + exports.ControlGroup = ControlGroup; + var ControlArray = (function(_super) { + __extends(ControlArray, _super); + function ControlArray(controls, validator) { + if (validator === void 0) { + validator = validators_1.Validators.array; + } + _super.call(this, validator); + this.controls = controls; + this._valueChanges = new async_1.EventEmitter(); + this._setParentForControls(); + this._updateValue(); + this.updateValidity({onlySelf: true}); + } + ControlArray.prototype.at = function(index) { + return this.controls[index]; + }; + ControlArray.prototype.push = function(control) { + this.controls.push(control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.insert = function(index, control) { + collection_1.ListWrapper.insert(this.controls, index, control); + control.setParent(this); + this.updateValueAndValidity(); + }; + ControlArray.prototype.removeAt = function(index) { + collection_1.ListWrapper.removeAt(this.controls, index); + this.updateValueAndValidity(); + }; + Object.defineProperty(ControlArray.prototype, "length", { + get: function() { + return this.controls.length; + }, + enumerable: true, + configurable: true + }); + ControlArray.prototype._updateValue = function() { + this._value = this.controls.map(function(control) { + return control.value; + }); + }; + ControlArray.prototype._setParentForControls = function() { + var _this = this; + this.controls.forEach(function(control) { + control.setParent(_this); + }); + }; + return ControlArray; + })(AbstractControl); + exports.ControlArray = ControlArray; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives/ng_control_name", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/shared", "angular2/src/core/forms/validators"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + var shared_1 = require("angular2/src/core/forms/directives/shared"); + var validators_1 = require("angular2/src/core/forms/validators"); + var controlNameBinding = lang_1.CONST_EXPR(new di_1.Binding(ng_control_1.NgControl, {toAlias: di_1.forwardRef(function() { + return NgControlName; + })})); + var NgControlName = (function(_super) { + __extends(NgControlName, _super); + function NgControlName(parent, validators) { + _super.call(this); + this.update = new async_1.EventEmitter(); + this._added = false; + this._parent = parent; + this.validators = validators; + } + NgControlName.prototype.onChanges = function(changes) { + if (!this._added) { + this.formDirective.addControl(this); + this._added = true; + } + if (shared_1.isPropertyUpdated(changes, this.viewModel)) { + this.viewModel = this.model; + this.formDirective.updateModel(this, this.model); + } + }; + NgControlName.prototype.onDestroy = function() { + this.formDirective.removeControl(this); + }; + NgControlName.prototype.viewToModelUpdate = function(newValue) { + this.viewModel = newValue; + async_1.ObservableWrapper.callNext(this.update, newValue); + }; + Object.defineProperty(NgControlName.prototype, "path", { + get: function() { + return shared_1.controlPath(this.name, this._parent); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "formDirective", { + get: function() { + return this._parent.formDirective; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "control", { + get: function() { + return this.formDirective.getControl(this); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(NgControlName.prototype, "validator", { + get: function() { + return validators_1.Validators.compose(this.validators); + }, + enumerable: true, + configurable: true + }); + NgControlName = __decorate([metadata_1.Directive({ + selector: '[ng-control]', + bindings: [controlNameBinding], + properties: ['name: ngControl', 'model: ngModel'], + events: ['update: ngModel'], + exportAs: 'form' + }), __param(0, di_1.Host()), __param(0, di_1.SkipSelf()), __param(1, di_1.Optional()), __param(1, di_1.Inject(validators_1.NG_VALIDATORS)), __metadata('design:paramtypes', [control_container_1.ControlContainer, Array])], NgControlName); + return NgControlName; + })(ng_control_1.NgControl); + exports.NgControlName = NgControlName; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms/directives", ["angular2/src/core/facade/lang", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives/validators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + var validators_1 = require("angular2/src/core/forms/directives/validators"); + var ng_control_name_2 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_2.NgControlName; + var ng_form_control_2 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_2.NgFormControl; + var ng_model_2 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_2.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_2 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_2.NgControlGroup; + var ng_form_model_2 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_2.NgFormModel; + var ng_form_2 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_2.NgForm; + var default_value_accessor_2 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_2.DefaultValueAccessor; + var checkbox_value_accessor_2 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_2.CheckboxControlValueAccessor; + var select_control_value_accessor_2 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.SelectControlValueAccessor = select_control_value_accessor_2.SelectControlValueAccessor; + exports.NgSelectOption = select_control_value_accessor_2.NgSelectOption; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + exports.FORM_DIRECTIVES = lang_1.CONST_EXPR([ng_control_name_1.NgControlName, ng_control_group_1.NgControlGroup, ng_form_control_1.NgFormControl, ng_model_1.NgModel, ng_form_model_1.NgFormModel, ng_form_1.NgForm, select_control_value_accessor_1.NgSelectOption, default_value_accessor_1.DefaultValueAccessor, checkbox_value_accessor_1.CheckboxControlValueAccessor, select_control_value_accessor_1.SelectControlValueAccessor, validators_1.DefaultValidators]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/debug", ["angular2/src/core/debug/debug_element", "angular2/src/core/debug/debug_element_view_listener"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/debug/debug_element")); + var debug_element_view_listener_1 = require("angular2/src/core/debug/debug_element_view_listener"); + exports.inspectNativeElement = debug_element_view_listener_1.inspectNativeElement; + exports.ELEMENT_PROBE_BINDINGS = debug_element_view_listener_1.ELEMENT_PROBE_BINDINGS; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/serializer", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/render/api", "angular2/src/web_workers/shared/api", "angular2/src/core/change_detection/change_detection", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/di", "angular2/src/web_workers/shared/render_proto_view_ref_store", "angular2/src/web_workers/shared/render_view_with_fragments_store"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var api_1 = require("angular2/src/core/render/api"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + var di_1 = require("angular2/src/core/di"); + var render_proto_view_ref_store_1 = require("angular2/src/web_workers/shared/render_proto_view_ref_store"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + exports.PRIMITIVE = String; + var Serializer = (function() { + function Serializer(_parser, _protoViewStore, _renderViewStore) { + this._parser = _parser; + this._protoViewStore = _protoViewStore; + this._renderViewStore = _renderViewStore; + this._enumRegistry = new collection_1.Map(); + var viewTypeMap = new collection_1.Map(); + viewTypeMap[0] = api_1.ViewType.HOST; + viewTypeMap[1] = api_1.ViewType.COMPONENT; + viewTypeMap[2] = api_1.ViewType.EMBEDDED; + this._enumRegistry.set(api_1.ViewType, viewTypeMap); + var viewEncapsulationMap = new collection_1.Map(); + viewEncapsulationMap[0] = api_1.ViewEncapsulation.Emulated; + viewEncapsulationMap[1] = api_1.ViewEncapsulation.Native; + viewEncapsulationMap[2] = api_1.ViewEncapsulation.None; + this._enumRegistry.set(api_1.ViewEncapsulation, viewEncapsulationMap); + var propertyBindingTypeMap = new collection_1.Map(); + propertyBindingTypeMap[0] = api_1.PropertyBindingType.PROPERTY; + propertyBindingTypeMap[1] = api_1.PropertyBindingType.ATTRIBUTE; + propertyBindingTypeMap[2] = api_1.PropertyBindingType.CLASS; + propertyBindingTypeMap[3] = api_1.PropertyBindingType.STYLE; + this._enumRegistry.set(api_1.PropertyBindingType, propertyBindingTypeMap); + } + Serializer.prototype.serialize = function(obj, type) { + var _this = this; + if (!lang_1.isPresent(obj)) { + return null; + } + if (lang_1.isArray(obj)) { + var serializedObj = []; + collection_1.ListWrapper.forEach(obj, function(val) { + serializedObj.push(_this.serialize(val, type)); + }); + return serializedObj; + } + if (type == exports.PRIMITIVE) { + return obj; + } + if (type == api_1.ViewDefinition) { + return this._serializeViewDefinition(obj); + } else if (type == api_1.DirectiveBinder) { + return this._serializeDirectiveBinder(obj); + } else if (type == api_1.ProtoViewDto) { + return this._serializeProtoViewDto(obj); + } else if (type == api_1.RenderElementBinder) { + return this._serializeElementBinder(obj); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._serializeDirectiveMetadata(obj); + } else if (type == change_detection_1.ASTWithSource) { + return this._serializeASTWithSource(obj); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.serialize(obj); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._serializeRenderProtoViewMergeMapping(obj); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.serializeRenderViewRef(obj); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.serializeRenderFragmentRef(obj); + } else if (type == api_2.WebWorkerElementRef) { + return this._serializeWorkerElementRef(obj); + } else if (type == api_1.ElementPropertyBinding) { + return this._serializeElementPropertyBinding(obj); + } else if (type == api_1.EventBinding) { + return this._serializeEventBinding(obj); + } else { + throw new exceptions_1.BaseException("No serializer for " + type.toString()); + } + }; + Serializer.prototype.deserialize = function(map, type, data) { + var _this = this; + if (!lang_1.isPresent(map)) { + return null; + } + if (lang_1.isArray(map)) { + var obj = []; + collection_1.ListWrapper.forEach(map, function(val) { + obj.push(_this.deserialize(val, type, data)); + }); + return obj; + } + if (type == exports.PRIMITIVE) { + return map; + } + if (type == api_1.ViewDefinition) { + return this._deserializeViewDefinition(map); + } else if (type == api_1.DirectiveBinder) { + return this._deserializeDirectiveBinder(map); + } else if (type == api_1.ProtoViewDto) { + return this._deserializeProtoViewDto(map); + } else if (type == api_1.RenderDirectiveMetadata) { + return this._deserializeDirectiveMetadata(map); + } else if (type == api_1.RenderElementBinder) { + return this._deserializeElementBinder(map); + } else if (type == change_detection_1.ASTWithSource) { + return this._deserializeASTWithSource(map, data); + } else if (type == api_1.RenderProtoViewRef) { + return this._protoViewStore.deserialize(map); + } else if (type == api_1.RenderProtoViewMergeMapping) { + return this._deserializeRenderProtoViewMergeMapping(map); + } else if (type == api_1.RenderViewRef) { + return this._renderViewStore.deserializeRenderViewRef(map); + } else if (type == api_1.RenderFragmentRef) { + return this._renderViewStore.deserializeRenderFragmentRef(map); + } else if (type == api_2.WebWorkerElementRef) { + return this._deserializeWorkerElementRef(map); + } else if (type == api_1.EventBinding) { + return this._deserializeEventBinding(map); + } else if (type == api_1.ElementPropertyBinding) { + return this._deserializeElementPropertyBinding(map); + } else { + throw new exceptions_1.BaseException("No deserializer for " + type.toString()); + } + }; + Serializer.prototype.mapToObject = function(map, type) { + var _this = this; + var object = {}; + var serialize = lang_1.isPresent(type); + collection_1.MapWrapper.forEach(map, function(value, key) { + if (serialize) { + object[key] = _this.serialize(value, type); + } else { + object[key] = value; + } + }); + return object; + }; + Serializer.prototype.objectToMap = function(obj, type, data) { + var _this = this; + if (lang_1.isPresent(type)) { + var map = new collection_1.Map(); + collection_1.StringMapWrapper.forEach(obj, function(val, key) { + map.set(key, _this.deserialize(val, type, data)); + }); + return map; + } else { + return collection_1.MapWrapper.createFromStringMap(obj); + } + }; + Serializer.prototype.allocateRenderViews = function(fragmentCount) { + this._renderViewStore.allocate(fragmentCount); + }; + Serializer.prototype._serializeElementPropertyBinding = function(binding) { + return { + 'type': lang_1.serializeEnum(binding.type), + 'astWithSource': this.serialize(binding.astWithSource, change_detection_1.ASTWithSource), + 'property': binding.property, + 'unit': binding.unit + }; + }; + Serializer.prototype._deserializeElementPropertyBinding = function(map) { + var type = lang_1.deserializeEnum(map['type'], this._enumRegistry.get(api_1.PropertyBindingType)); + var ast = this.deserialize(map['astWithSource'], change_detection_1.ASTWithSource, "binding"); + return new api_1.ElementPropertyBinding(type, ast, map['property'], map['unit']); + }; + Serializer.prototype._serializeEventBinding = function(binding) { + return { + 'fullName': binding.fullName, + 'source': this.serialize(binding.source, change_detection_1.ASTWithSource) + }; + }; + Serializer.prototype._deserializeEventBinding = function(map) { + return new api_1.EventBinding(map['fullName'], this.deserialize(map['source'], change_detection_1.ASTWithSource, "action")); + }; + Serializer.prototype._serializeWorkerElementRef = function(elementRef) { + return { + 'renderView': this.serialize(elementRef.renderView, api_1.RenderViewRef), + 'renderBoundElementIndex': elementRef.renderBoundElementIndex + }; + }; + Serializer.prototype._deserializeWorkerElementRef = function(map) { + return new api_2.WebWorkerElementRef(this.deserialize(map['renderView'], api_1.RenderViewRef), map['renderBoundElementIndex']); + }; + Serializer.prototype._serializeRenderProtoViewMergeMapping = function(mapping) { + return { + 'mergedProtoViewRef': this._protoViewStore.serialize(mapping.mergedProtoViewRef), + 'fragmentCount': mapping.fragmentCount, + 'mappedElementIndices': mapping.mappedElementIndices, + 'mappedElementCount': mapping.mappedElementCount, + 'mappedTextIndices': mapping.mappedTextIndices, + 'hostElementIndicesByViewIndex': mapping.hostElementIndicesByViewIndex, + 'nestedViewCountByViewIndex': mapping.nestedViewCountByViewIndex + }; + }; + Serializer.prototype._deserializeRenderProtoViewMergeMapping = function(obj) { + return new api_1.RenderProtoViewMergeMapping(this._protoViewStore.deserialize(obj['mergedProtoViewRef']), obj['fragmentCount'], obj['mappedElementIndices'], obj['mappedElementCount'], obj['mappedTextIndices'], obj['hostElementIndicesByViewIndex'], obj['nestedViewCountByViewIndex']); + }; + Serializer.prototype._serializeASTWithSource = function(tree) { + return { + 'input': tree.source, + 'location': tree.location + }; + }; + Serializer.prototype._deserializeASTWithSource = function(obj, data) { + var ast; + switch (data) { + case "action": + ast = this._parser.parseAction(obj['input'], obj['location']); + break; + case "binding": + ast = this._parser.parseBinding(obj['input'], obj['location']); + break; + case "interpolation": + ast = this._parser.parseInterpolation(obj['input'], obj['location']); + break; + default: + throw "No AST deserializer for " + data; + } + return ast; + }; + Serializer.prototype._serializeViewDefinition = function(view) { + return { + 'componentId': view.componentId, + 'templateAbsUrl': view.templateAbsUrl, + 'template': view.template, + 'directives': this.serialize(view.directives, api_1.RenderDirectiveMetadata), + 'styleAbsUrls': view.styleAbsUrls, + 'styles': view.styles, + 'encapsulation': lang_1.serializeEnum(view.encapsulation) + }; + }; + Serializer.prototype._deserializeViewDefinition = function(obj) { + return new api_1.ViewDefinition({ + componentId: obj['componentId'], + templateAbsUrl: obj['templateAbsUrl'], + template: obj['template'], + directives: this.deserialize(obj['directives'], api_1.RenderDirectiveMetadata), + styleAbsUrls: obj['styleAbsUrls'], + styles: obj['styles'], + encapsulation: lang_1.deserializeEnum(obj['encapsulation'], this._enumRegistry.get(api_1.ViewEncapsulation)) + }); + }; + Serializer.prototype._serializeDirectiveBinder = function(binder) { + return { + 'directiveIndex': binder.directiveIndex, + 'propertyBindings': this.mapToObject(binder.propertyBindings, change_detection_1.ASTWithSource), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'hostPropertyBindings': this.serialize(binder.hostPropertyBindings, api_1.ElementPropertyBinding) + }; + }; + Serializer.prototype._deserializeDirectiveBinder = function(obj) { + return new api_1.DirectiveBinder({ + directiveIndex: obj['directiveIndex'], + propertyBindings: this.objectToMap(obj['propertyBindings'], change_detection_1.ASTWithSource, "binding"), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + hostPropertyBindings: this.deserialize(obj['hostPropertyBindings'], api_1.ElementPropertyBinding) + }); + }; + Serializer.prototype._serializeElementBinder = function(binder) { + return { + 'index': binder.index, + 'parentIndex': binder.parentIndex, + 'distanceToParent': binder.distanceToParent, + 'directives': this.serialize(binder.directives, api_1.DirectiveBinder), + 'nestedProtoView': this.serialize(binder.nestedProtoView, api_1.ProtoViewDto), + 'propertyBindings': this.serialize(binder.propertyBindings, api_1.ElementPropertyBinding), + 'variableBindings': this.mapToObject(binder.variableBindings), + 'eventBindings': this.serialize(binder.eventBindings, api_1.EventBinding), + 'readAttributes': this.mapToObject(binder.readAttributes) + }; + }; + Serializer.prototype._deserializeElementBinder = function(obj) { + return new api_1.RenderElementBinder({ + index: obj['index'], + parentIndex: obj['parentIndex'], + distanceToParent: obj['distanceToParent'], + directives: this.deserialize(obj['directives'], api_1.DirectiveBinder), + nestedProtoView: this.deserialize(obj['nestedProtoView'], api_1.ProtoViewDto), + propertyBindings: this.deserialize(obj['propertyBindings'], api_1.ElementPropertyBinding), + variableBindings: this.objectToMap(obj['variableBindings']), + eventBindings: this.deserialize(obj['eventBindings'], api_1.EventBinding), + readAttributes: this.objectToMap(obj['readAttributes']) + }); + }; + Serializer.prototype._serializeProtoViewDto = function(view) { + return { + 'render': this._protoViewStore.serialize(view.render), + 'elementBinders': this.serialize(view.elementBinders, api_1.RenderElementBinder), + 'variableBindings': this.mapToObject(view.variableBindings), + 'type': lang_1.serializeEnum(view.type), + 'textBindings': this.serialize(view.textBindings, change_detection_1.ASTWithSource), + 'transitiveNgContentCount': view.transitiveNgContentCount + }; + }; + Serializer.prototype._deserializeProtoViewDto = function(obj) { + return new api_1.ProtoViewDto({ + render: this._protoViewStore.deserialize(obj["render"]), + elementBinders: this.deserialize(obj['elementBinders'], api_1.RenderElementBinder), + variableBindings: this.objectToMap(obj['variableBindings']), + textBindings: this.deserialize(obj['textBindings'], change_detection_1.ASTWithSource, "interpolation"), + type: lang_1.deserializeEnum(obj['type'], this._enumRegistry.get(api_1.ViewType)), + transitiveNgContentCount: obj['transitiveNgContentCount'] + }); + }; + Serializer.prototype._serializeDirectiveMetadata = function(meta) { + var obj = { + 'id': meta.id, + 'selector': meta.selector, + 'compileChildren': meta.compileChildren, + 'events': meta.events, + 'properties': meta.properties, + 'readAttributes': meta.readAttributes, + 'type': meta.type, + 'callOnDestroy': meta.callOnDestroy, + 'callOnChanges': meta.callOnChanges, + 'callDoCheck': meta.callDoCheck, + 'callOnInit': meta.callOnInit, + 'callAfterContentChecked': meta.callAfterContentChecked, + 'changeDetection': meta.changeDetection, + 'exportAs': meta.exportAs, + 'hostProperties': this.mapToObject(meta.hostProperties), + 'hostListeners': this.mapToObject(meta.hostListeners), + 'hostAttributes': this.mapToObject(meta.hostAttributes) + }; + return obj; + }; + Serializer.prototype._deserializeDirectiveMetadata = function(obj) { + return new api_1.RenderDirectiveMetadata({ + id: obj['id'], + selector: obj['selector'], + compileChildren: obj['compileChildren'], + hostProperties: this.objectToMap(obj['hostProperties']), + hostListeners: this.objectToMap(obj['hostListeners']), + hostAttributes: this.objectToMap(obj['hostAttributes']), + properties: obj['properties'], + readAttributes: obj['readAttributes'], + type: obj['type'], + exportAs: obj['exportAs'], + callOnDestroy: obj['callOnDestroy'], + callOnChanges: obj['callOnChanges'], + callDoCheck: obj['callDoCheck'], + callOnInit: obj['callOnInit'], + callAfterContentChecked: obj['callAfterContentChecked'], + changeDetection: obj['changeDetection'], + events: obj['events'] + }); + }; + Serializer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [parser_1.Parser, render_proto_view_ref_store_1.RenderProtoViewRefStore, render_view_with_fragments_store_1.RenderViewWithFragmentsStore])], Serializer); + return Serializer; + })(); + exports.Serializer = Serializer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/event_dispatcher", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/render/api", "angular2/src/web_workers/shared/serializer", "angular2/src/web_workers/shared/messaging_api", "angular2/src/web_workers/shared/message_bus", "angular2/src/core/facade/async", "angular2/src/web_workers/worker/event_deserializer"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var api_1 = require("angular2/src/core/render/api"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var async_1 = require("angular2/src/core/facade/async"); + var event_deserializer_1 = require("angular2/src/web_workers/worker/event_deserializer"); + var WebWorkerEventDispatcher = (function() { + function WebWorkerEventDispatcher(bus, _serializer) { + var _this = this; + this._serializer = _serializer; + this._eventDispatchRegistry = new collection_1.Map(); + bus.initChannel(messaging_api_1.EVENT_CHANNEL); + var source = bus.from(messaging_api_1.EVENT_CHANNEL); + async_1.ObservableWrapper.subscribe(source, function(message) { + return _this._dispatchEvent(new RenderEventData(message, _serializer)); + }); + } + WebWorkerEventDispatcher.prototype._dispatchEvent = function(eventData) { + var dispatcher = this._eventDispatchRegistry.get(eventData.viewRef); + eventData.locals['$event'] = event_deserializer_1.deserializeGenericEvent(eventData.locals['$event']); + dispatcher.dispatchRenderEvent(eventData.elementIndex, eventData.eventName, eventData.locals); + }; + WebWorkerEventDispatcher.prototype.registerEventDispatcher = function(viewRef, dispatcher) { + this._eventDispatchRegistry.set(viewRef, dispatcher); + }; + WebWorkerEventDispatcher = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, serializer_1.Serializer])], WebWorkerEventDispatcher); + return WebWorkerEventDispatcher; + })(); + exports.WebWorkerEventDispatcher = WebWorkerEventDispatcher; + var RenderEventData = (function() { + function RenderEventData(message, serializer) { + this.viewRef = serializer.deserialize(message['viewRef'], api_1.RenderViewRef); + this.elementIndex = message['elementIndex']; + this.eventName = message['eventName']; + this.locals = collection_1.MapWrapper.createFromStringMap(message['locals']); + } + return RenderEventData; + })(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/binding", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/di/key", "angular2/src/core/di/metadata", "angular2/src/core/di/exceptions", "angular2/src/core/di/forward_ref"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var exceptions_2 = require("angular2/src/core/di/exceptions"); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + var Dependency = (function() { + function Dependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties) { + this.key = key; + this.optional = optional; + this.lowerBoundVisibility = lowerBoundVisibility; + this.upperBoundVisibility = upperBoundVisibility; + this.properties = properties; + } + Dependency.fromKey = function(key) { + return new Dependency(key, false, null, null, []); + }; + return Dependency; + })(); + exports.Dependency = Dependency; + var _EMPTY_LIST = lang_1.CONST_EXPR([]); + var Binding = (function() { + function Binding(token, _a) { + var toClass = _a.toClass, + toValue = _a.toValue, + toAlias = _a.toAlias, + toFactory = _a.toFactory, + deps = _a.deps, + multi = _a.multi; + this.token = token; + this.toClass = toClass; + this.toValue = toValue; + this.toAlias = toAlias; + this.toFactory = toFactory; + this.dependencies = deps; + this._multi = multi; + } + Object.defineProperty(Binding.prototype, "multi", { + get: function() { + return lang_1.normalizeBool(this._multi); + }, + enumerable: true, + configurable: true + }); + Binding = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object, Object])], Binding); + return Binding; + })(); + exports.Binding = Binding; + var ResolvedBinding = (function() { + function ResolvedBinding(key, resolvedFactories, multiBinding) { + this.key = key; + this.resolvedFactories = resolvedFactories; + this.multiBinding = multiBinding; + } + Object.defineProperty(ResolvedBinding.prototype, "resolvedFactory", { + get: function() { + return this.resolvedFactories[0]; + }, + enumerable: true, + configurable: true + }); + return ResolvedBinding; + })(); + exports.ResolvedBinding = ResolvedBinding; + var ResolvedFactory = (function() { + function ResolvedFactory(factory, dependencies) { + this.factory = factory; + this.dependencies = dependencies; + } + return ResolvedFactory; + })(); + exports.ResolvedFactory = ResolvedFactory; + function bind(token) { + return new BindingBuilder(token); + } + exports.bind = bind; + var BindingBuilder = (function() { + function BindingBuilder(token) { + this.token = token; + } + BindingBuilder.prototype.toClass = function(type) { + return new Binding(this.token, {toClass: type}); + }; + BindingBuilder.prototype.toValue = function(value) { + return new Binding(this.token, {toValue: value}); + }; + BindingBuilder.prototype.toAlias = function(aliasToken) { + if (lang_1.isBlank(aliasToken)) { + throw new exceptions_1.BaseException("Can not alias " + lang_1.stringify(this.token) + " to a blank value!"); + } + return new Binding(this.token, {toAlias: aliasToken}); + }; + BindingBuilder.prototype.toFactory = function(factoryFunction, dependencies) { + return new Binding(this.token, { + toFactory: factoryFunction, + deps: dependencies + }); + }; + return BindingBuilder; + })(); + exports.BindingBuilder = BindingBuilder; + function resolveFactory(binding) { + var factoryFn; + var resolvedDeps; + if (lang_1.isPresent(binding.toClass)) { + var toClass = forward_ref_1.resolveForwardRef(binding.toClass); + factoryFn = reflection_1.reflector.factory(toClass); + resolvedDeps = _dependenciesFor(toClass); + } else if (lang_1.isPresent(binding.toAlias)) { + factoryFn = function(aliasInstance) { + return aliasInstance; + }; + resolvedDeps = [Dependency.fromKey(key_1.Key.get(binding.toAlias))]; + } else if (lang_1.isPresent(binding.toFactory)) { + factoryFn = binding.toFactory; + resolvedDeps = _constructDependencies(binding.toFactory, binding.dependencies); + } else { + factoryFn = function() { + return binding.toValue; + }; + resolvedDeps = _EMPTY_LIST; + } + return new ResolvedFactory(factoryFn, resolvedDeps); + } + exports.resolveFactory = resolveFactory; + function resolveBinding(binding) { + return new ResolvedBinding(key_1.Key.get(binding.token), [resolveFactory(binding)], false); + } + exports.resolveBinding = resolveBinding; + function resolveBindings(bindings) { + var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map())); + return normalized.map(function(b) { + if (b instanceof _NormalizedBinding) { + return new ResolvedBinding(b.key, [b.resolvedFactory], false); + } else { + var arr = b; + return new ResolvedBinding(arr[0].key, arr.map(function(_) { + return _.resolvedFactory; + }), true); + } + }); + } + exports.resolveBindings = resolveBindings; + var _NormalizedBinding = (function() { + function _NormalizedBinding(key, resolvedFactory) { + this.key = key; + this.resolvedFactory = resolvedFactory; + } + return _NormalizedBinding; + })(); + function _createListOfBindings(flattenedBindings) { + return collection_1.MapWrapper.values(flattenedBindings); + } + function _normalizeBindings(bindings, res) { + collection_1.ListWrapper.forEach(bindings, function(b) { + if (b instanceof lang_1.Type) { + _normalizeBinding(bind(b).toClass(b), res); + } else if (b instanceof Binding) { + _normalizeBinding(b, res); + } else if (b instanceof Array) { + _normalizeBindings(b, res); + } else if (b instanceof BindingBuilder) { + throw new exceptions_2.InvalidBindingError(b.token); + } else { + throw new exceptions_2.InvalidBindingError(b); + } + }); + return res; + } + function _normalizeBinding(b, res) { + var key = key_1.Key.get(b.token); + var factory = resolveFactory(b); + var normalized = new _NormalizedBinding(key, factory); + if (b.multi) { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + existingBinding.push(normalized); + } else if (lang_1.isBlank(existingBinding)) { + res.set(key.id, [normalized]); + } else { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + } else { + var existingBinding = res.get(key.id); + if (existingBinding instanceof Array) { + throw new exceptions_2.MixingMultiBindingsWithRegularBindings(existingBinding, b); + } + res.set(key.id, normalized); + } + } + function _constructDependencies(factoryFunction, dependencies) { + if (lang_1.isBlank(dependencies)) { + return _dependenciesFor(factoryFunction); + } else { + var params = collection_1.ListWrapper.map(dependencies, function(t) { + return [t]; + }); + return collection_1.ListWrapper.map(dependencies, function(t) { + return _extractToken(factoryFunction, t, params); + }); + } + } + function _dependenciesFor(typeOrFunc) { + var params = reflection_1.reflector.parameters(typeOrFunc); + if (lang_1.isBlank(params)) + return []; + if (collection_1.ListWrapper.any(params, function(p) { + return lang_1.isBlank(p); + })) { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + return collection_1.ListWrapper.map(params, function(p) { + return _extractToken(typeOrFunc, p, params); + }); + } + function _extractToken(typeOrFunc, metadata, params) { + var depProps = []; + var token = null; + var optional = false; + if (!lang_1.isArray(metadata)) { + return _createDependency(metadata, optional, null, null, depProps); + } + var lowerBoundVisibility = null; + var upperBoundVisibility = null; + for (var i = 0; i < metadata.length; ++i) { + var paramMetadata = metadata[i]; + if (paramMetadata instanceof lang_1.Type) { + token = paramMetadata; + } else if (paramMetadata instanceof metadata_1.InjectMetadata) { + token = paramMetadata.token; + } else if (paramMetadata instanceof metadata_1.OptionalMetadata) { + optional = true; + } else if (paramMetadata instanceof metadata_1.SelfMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.HostMetadata) { + upperBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.SkipSelfMetadata) { + lowerBoundVisibility = paramMetadata; + } else if (paramMetadata instanceof metadata_1.DependencyMetadata) { + if (lang_1.isPresent(paramMetadata.token)) { + token = paramMetadata.token; + } + depProps.push(paramMetadata); + } + } + token = forward_ref_1.resolveForwardRef(token); + if (lang_1.isPresent(token)) { + return _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } else { + throw new exceptions_2.NoAnnotationError(typeOrFunc, params); + } + } + function _createDependency(token, optional, lowerBoundVisibility, upperBoundVisibility, depProps) { + return new Dependency(key_1.Key.get(token), optional, lowerBoundVisibility, upperBoundVisibility, depProps); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/abstract_change_detector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/constants", "angular2/src/core/profile/profile", "angular2/src/core/change_detection/observable_facade"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + var exceptions_2 = require("angular2/src/core/change_detection/exceptions"); + var constants_1 = require("angular2/src/core/change_detection/constants"); + var profile_1 = require("angular2/src/core/profile/profile"); + var observable_facade_1 = require("angular2/src/core/change_detection/observable_facade"); + var _scope_check = profile_1.wtfCreateScope("ChangeDetector#check(ascii id, bool throwOnChange)"); + var _Context = (function() { + function _Context(element, componentElement, context, locals, injector, expression) { + this.element = element; + this.componentElement = componentElement; + this.context = context; + this.locals = locals; + this.injector = injector; + this.expression = expression; + } + return _Context; + })(); + var AbstractChangeDetector = (function() { + function AbstractChangeDetector(id, dispatcher, numberOfPropertyProtoRecords, bindingTargets, directiveIndices, strategy) { + this.id = id; + this.dispatcher = dispatcher; + this.numberOfPropertyProtoRecords = numberOfPropertyProtoRecords; + this.bindingTargets = bindingTargets; + this.directiveIndices = directiveIndices; + this.strategy = strategy; + this.lightDomChildren = []; + this.shadowDomChildren = []; + this.alreadyChecked = false; + this.locals = null; + this.mode = null; + this.pipes = null; + this.ref = new change_detector_ref_1.ChangeDetectorRef(this); + } + AbstractChangeDetector.prototype.addChild = function(cd) { + this.lightDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeChild = function(cd) { + collection_1.ListWrapper.remove(this.lightDomChildren, cd); + }; + AbstractChangeDetector.prototype.addShadowDomChild = function(cd) { + this.shadowDomChildren.push(cd); + cd.parent = this; + }; + AbstractChangeDetector.prototype.removeShadowDomChild = function(cd) { + collection_1.ListWrapper.remove(this.shadowDomChildren, cd); + }; + AbstractChangeDetector.prototype.remove = function() { + this.parent.removeChild(this); + }; + AbstractChangeDetector.prototype.handleEvent = function(eventName, elIndex, locals) { + var res = this.handleEventInternal(eventName, elIndex, locals); + this.markPathToRootAsCheckOnce(); + return res; + }; + AbstractChangeDetector.prototype.handleEventInternal = function(eventName, elIndex, locals) { + return false; + }; + AbstractChangeDetector.prototype.detectChanges = function() { + this.runDetectChanges(false); + }; + AbstractChangeDetector.prototype.checkNoChanges = function() { + throw new exceptions_1.BaseException("Not implemented"); + }; + AbstractChangeDetector.prototype.runDetectChanges = function(throwOnChange) { + if (this.mode === constants_1.ChangeDetectionStrategy.Detached || this.mode === constants_1.ChangeDetectionStrategy.Checked) + return ; + var s = _scope_check(this.id, throwOnChange); + this.detectChangesInRecords(throwOnChange); + this._detectChangesInLightDomChildren(throwOnChange); + if (!throwOnChange) + this.afterContentLifecycleCallbacks(); + this._detectChangesInShadowDomChildren(throwOnChange); + if (!throwOnChange) + this.afterViewLifecycleCallbacks(); + if (this.mode === constants_1.ChangeDetectionStrategy.CheckOnce) + this.mode = constants_1.ChangeDetectionStrategy.Checked; + this.alreadyChecked = true; + profile_1.wtfLeave(s); + }; + AbstractChangeDetector.prototype.detectChangesInRecords = function(throwOnChange) { + if (!this.hydrated()) { + this.throwDehydratedError(); + } + try { + this.detectChangesInRecordsInternal(throwOnChange); + } catch (e) { + this._throwError(e, e.stack); + } + }; + AbstractChangeDetector.prototype.detectChangesInRecordsInternal = function(throwOnChange) {}; + AbstractChangeDetector.prototype.hydrate = function(context, locals, directives, pipes) { + this.mode = change_detection_util_1.ChangeDetectionUtil.changeDetectionMode(this.strategy); + this.context = context; + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this.observeComponent(context); + } + this.locals = locals; + this.pipes = pipes; + this.hydrateDirectives(directives); + this.alreadyChecked = false; + }; + AbstractChangeDetector.prototype.hydrateDirectives = function(directives) {}; + AbstractChangeDetector.prototype.dehydrate = function() { + this.dehydrateDirectives(true); + if (this.strategy === constants_1.ChangeDetectionStrategy.OnPushObserve) { + this._unsubsribeFromObservables(); + } + this.context = null; + this.locals = null; + this.pipes = null; + }; + AbstractChangeDetector.prototype.dehydrateDirectives = function(destroyPipes) {}; + AbstractChangeDetector.prototype.hydrated = function() { + return this.context !== null; + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacks = function() { + this.dispatcher.notifyAfterContentChecked(); + this.afterContentLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterContentLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacks = function() { + this.dispatcher.notifyAfterViewChecked(); + this.afterViewLifecycleCallbacksInternal(); + }; + AbstractChangeDetector.prototype.afterViewLifecycleCallbacksInternal = function() {}; + AbstractChangeDetector.prototype._detectChangesInLightDomChildren = function(throwOnChange) { + var c = this.lightDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype._detectChangesInShadowDomChildren = function(throwOnChange) { + var c = this.shadowDomChildren; + for (var i = 0; i < c.length; ++i) { + c[i].runDetectChanges(throwOnChange); + } + }; + AbstractChangeDetector.prototype.markAsCheckOnce = function() { + this.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + }; + AbstractChangeDetector.prototype.markPathToRootAsCheckOnce = function() { + var c = this; + while (lang_1.isPresent(c) && c.mode !== constants_1.ChangeDetectionStrategy.Detached) { + if (c.mode === constants_1.ChangeDetectionStrategy.Checked) + c.mode = constants_1.ChangeDetectionStrategy.CheckOnce; + c = c.parent; + } + }; + AbstractChangeDetector.prototype._unsubsribeFromObservables = function() { + if (lang_1.isPresent(this.subscriptions)) { + for (var i = 0; i < this.subscriptions.length; ++i) { + var s = this.subscriptions[i]; + if (lang_1.isPresent(this.subscriptions[i])) { + s.cancel(); + this.subscriptions[i] = null; + } + } + } + }; + AbstractChangeDetector.prototype.observeValue = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + if (lang_1.isBlank(this.subscriptions[index])) { + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } else if (this.streams[index] !== value.changes) { + this.subscriptions[index].cancel(); + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + } + return value; + }; + AbstractChangeDetector.prototype.observeDirective = function(value, index) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var arrayIndex = this.numberOfPropertyProtoRecords + index + 2; + this.streams[arrayIndex] = value.changes; + this.subscriptions[arrayIndex] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype.observeComponent = function(value) { + var _this = this; + if (observable_facade_1.isObservable(value)) { + this._createArrayToStoreObservables(); + var index = this.numberOfPropertyProtoRecords + 1; + this.streams[index] = value.changes; + this.subscriptions[index] = value.changes.listen(function(_) { + return _this.ref.markForCheck(); + }); + } + return value; + }; + AbstractChangeDetector.prototype._createArrayToStoreObservables = function() { + if (lang_1.isBlank(this.subscriptions)) { + this.subscriptions = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + this.streams = collection_1.ListWrapper.createFixedSize(this.numberOfPropertyProtoRecords + this.directiveIndices.length + 2); + } + }; + AbstractChangeDetector.prototype.getDirectiveFor = function(directives, index) { + return directives.getDirectiveFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.getDetectorFor = function(directives, index) { + return directives.getDetectorFor(this.directiveIndices[index]); + }; + AbstractChangeDetector.prototype.notifyDispatcher = function(value) { + this.dispatcher.notifyOnBinding(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.logBindingUpdate = function(value) { + this.dispatcher.logBindingUpdate(this._currentBinding(), value); + }; + AbstractChangeDetector.prototype.addChange = function(changes, oldValue, newValue) { + if (lang_1.isBlank(changes)) { + changes = {}; + } + changes[this._currentBinding().name] = change_detection_util_1.ChangeDetectionUtil.simpleChange(oldValue, newValue); + return changes; + }; + AbstractChangeDetector.prototype._throwError = function(exception, stack) { + var c = this.dispatcher.getDebugContext(this._currentBinding().elementIndex, null); + var context = lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.context, c.locals, c.injector, this._currentBinding().debug) : null; + throw new exceptions_2.ChangeDetectionError(this._currentBinding().debug, exception, stack, context); + }; + AbstractChangeDetector.prototype.throwOnChangeError = function(oldValue, newValue) { + throw new exceptions_2.ExpressionChangedAfterItHasBeenCheckedException(this._currentBinding().debug, oldValue, newValue, null); + }; + AbstractChangeDetector.prototype.throwDehydratedError = function() { + throw new exceptions_2.DehydratedException(); + }; + AbstractChangeDetector.prototype._currentBinding = function() { + return this.bindingTargets[this.propertyBindingIndex]; + }; + return AbstractChangeDetector; + })(); + exports.AbstractChangeDetector = AbstractChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("@reactivex/rxjs/dist/cjs/Observable", ["@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/util/Symbol_observable"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _utilSymbol_observable = require("@reactivex/rxjs/dist/cjs/util/Symbol_observable"); + var _utilSymbol_observable2 = _interopRequireDefault(_utilSymbol_observable); + var Observable = (function() { + function Observable(subscribe) { + _classCallCheck(this, Observable); + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function lift(operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype[_utilSymbol_observable2['default']] = function() { + return this; + }; + Observable.prototype.subscribe = function subscribe(observerOrNext, error, complete) { + var subscriber = undefined; + if (observerOrNext && typeof observerOrNext === "object") { + if (observerOrNext instanceof _Subscriber2['default']) { + subscriber = observerOrNext; + } else { + subscriber = new _Subscriber2['default'](observerOrNext); + } + } else { + var next = observerOrNext; + subscriber = _Subscriber2['default'].create(next, error, complete); + } + subscriber.add(this._subscribe(subscriber)); + return subscriber; + }; + Observable.prototype.forEach = function forEach(next) { + var _this = this; + return new Promise(function(resolve, reject) { + _this.subscribe(next, reject, resolve); + }); + }; + Observable.prototype._subscribe = function _subscribe(subscriber) { + return this.source._subscribe(this.operator.call(subscriber)); + }; + return Observable; + })(); + exports['default'] = Observable; + Observable.create = function(subscribe) { + return new Observable(subscribe); + }; + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager_utils", ["angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/compiler/element_injector", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view", "angular2/src/core/compiler/view_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/pipes/pipes", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 collection_1 = require("angular2/src/core/facade/collection"); + var eli = require("angular2/src/core/compiler/element_injector"); + var lang_1 = require("angular2/src/core/facade/lang"); + var viewModule = require("angular2/src/core/compiler/view"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var pipes_1 = require("angular2/src/core/pipes/pipes"); + var api_1 = require("angular2/src/core/render/api"); + var AppViewManagerUtils = (function() { + function AppViewManagerUtils() {} + AppViewManagerUtils.prototype.getComponentInstance = function(parentView, boundElementIndex) { + var eli = parentView.elementInjectors[boundElementIndex]; + return eli.getComponent(); + }; + AppViewManagerUtils.prototype.createView = function(mergedParentViewProto, renderViewWithFragments, viewManager, renderer) { + var renderFragments = renderViewWithFragments.fragmentRefs; + var renderView = renderViewWithFragments.viewRef; + var elementCount = mergedParentViewProto.mergeMapping.renderElementIndices.length; + var viewCount = mergedParentViewProto.mergeMapping.nestedViewCountByViewIndex[0] + 1; + var elementRefs = collection_1.ListWrapper.createFixedSize(elementCount); + var viewContainers = collection_1.ListWrapper.createFixedSize(elementCount); + var preBuiltObjects = collection_1.ListWrapper.createFixedSize(elementCount); + var elementInjectors = collection_1.ListWrapper.createFixedSize(elementCount); + var views = collection_1.ListWrapper.createFixedSize(viewCount); + var elementOffset = 0; + var textOffset = 0; + var fragmentIdx = 0; + for (var viewOffset = 0; viewOffset < viewCount; viewOffset++) { + var hostElementIndex = mergedParentViewProto.mergeMapping.hostElementIndicesByViewIndex[viewOffset]; + var parentView = lang_1.isPresent(hostElementIndex) ? view_ref_1.internalView(elementRefs[hostElementIndex].parentView) : null; + var protoView = lang_1.isPresent(hostElementIndex) ? parentView.proto.elementBinders[hostElementIndex - parentView.elementOffset].nestedProtoView : mergedParentViewProto; + var renderFragment = null; + if (viewOffset === 0 || protoView.type === api_1.ViewType.EMBEDDED) { + renderFragment = renderFragments[fragmentIdx++]; + } + var currentView = new viewModule.AppView(renderer, protoView, mergedParentViewProto.mergeMapping, viewOffset, elementOffset, textOffset, protoView.protoLocals, renderView, renderFragment); + views[viewOffset] = currentView; + var rootElementInjectors = []; + for (var binderIdx = 0; binderIdx < protoView.elementBinders.length; binderIdx++) { + var binder = protoView.elementBinders[binderIdx]; + var boundElementIndex = elementOffset + binderIdx; + var elementInjector = null; + var protoElementInjector = binder.protoElementInjector; + if (lang_1.isPresent(protoElementInjector)) { + if (lang_1.isPresent(protoElementInjector.parent)) { + var parentElementInjector = elementInjectors[elementOffset + protoElementInjector.parent.index]; + elementInjector = protoElementInjector.instantiate(parentElementInjector); + } else { + elementInjector = protoElementInjector.instantiate(null); + rootElementInjectors.push(elementInjector); + } + } + elementInjectors[boundElementIndex] = elementInjector; + var el = new element_ref_1.ElementRef(currentView.ref, boundElementIndex, mergedParentViewProto.mergeMapping.renderElementIndices[boundElementIndex], renderer); + elementRefs[el.boundElementIndex] = el; + if (lang_1.isPresent(elementInjector)) { + var templateRef = binder.hasEmbeddedProtoView() ? new template_ref_1.TemplateRef(el) : null; + preBuiltObjects[boundElementIndex] = new eli.PreBuiltObjects(viewManager, currentView, el, templateRef); + } + } + currentView.init(protoView.protoChangeDetector.instantiate(currentView), elementInjectors, rootElementInjectors, preBuiltObjects, views, elementRefs, viewContainers); + if (lang_1.isPresent(parentView) && protoView.type === api_1.ViewType.COMPONENT) { + parentView.changeDetector.addShadowDomChild(currentView.changeDetector); + } + elementOffset += protoView.elementBinders.length; + textOffset += protoView.textBindingCount; + } + return views[0]; + }; + AppViewManagerUtils.prototype.hydrateRootHostView = function(hostView, injector) { + this._hydrateView(hostView, injector, null, new Object(), null); + }; + AppViewManagerUtils.prototype.attachViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + parentView.changeDetector.addChild(view.changeDetector); + var viewContainer = parentView.viewContainers[boundElementIndex]; + if (lang_1.isBlank(viewContainer)) { + viewContainer = new viewModule.AppViewContainer(); + parentView.viewContainers[boundElementIndex] = viewContainer; + } + collection_1.ListWrapper.insert(viewContainer.views, atIndex, view); + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + for (var i = view.rootElementInjectors.length - 1; i >= 0; i--) { + if (lang_1.isPresent(elementInjector.parent)) { + view.rootElementInjectors[i].link(elementInjector.parent); + } + } + elementInjector.traverseAndSetQueriesAsDirty(); + }; + AppViewManagerUtils.prototype.detachViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + parentView.elementInjectors[boundElementIndex].traverseAndSetQueriesAsDirty(); + view.changeDetector.remove(); + collection_1.ListWrapper.removeAt(viewContainer.views, atIndex); + for (var i = 0; i < view.rootElementInjectors.length; ++i) { + var inj = view.rootElementInjectors[i]; + inj.unlink(); + } + }; + AppViewManagerUtils.prototype.hydrateViewInContainer = function(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedBindings) { + if (lang_1.isBlank(contextView)) { + contextView = parentView; + contextBoundElementIndex = boundElementIndex; + } + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + var elementInjector = contextView.elementInjectors[contextBoundElementIndex]; + var injector = lang_1.isPresent(imperativelyCreatedBindings) ? di_1.Injector.fromResolvedBindings(imperativelyCreatedBindings) : null; + this._hydrateView(view, injector, elementInjector.getHost(), contextView.context, contextView.locals); + }; + AppViewManagerUtils.prototype._hydrateView = function(initView, imperativelyCreatedInjector, hostElementInjector, context, parentLocals) { + var viewIdx = initView.viewOffset; + var endViewOffset = viewIdx + initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx]; + while (viewIdx <= endViewOffset) { + var currView = initView.views[viewIdx]; + var currProtoView = currView.proto; + if (currView !== initView && currView.proto.type === api_1.ViewType.EMBEDDED) { + viewIdx += initView.mainMergeMapping.nestedViewCountByViewIndex[viewIdx] + 1; + } else { + if (currView !== initView) { + imperativelyCreatedInjector = null; + parentLocals = null; + var hostElementIndex = initView.mainMergeMapping.hostElementIndicesByViewIndex[viewIdx]; + hostElementInjector = initView.elementInjectors[hostElementIndex]; + context = hostElementInjector.getComponent(); + } + currView.context = context; + currView.locals.parent = parentLocals; + var binders = currProtoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var boundElementIndex = binderIdx + currView.elementOffset; + var elementInjector = initView.elementInjectors[boundElementIndex]; + if (lang_1.isPresent(elementInjector)) { + elementInjector.hydrate(imperativelyCreatedInjector, hostElementInjector, currView.preBuiltObjects[boundElementIndex]); + this._populateViewLocals(currView, elementInjector, boundElementIndex); + this._setUpEventEmitters(currView, elementInjector, boundElementIndex); + } + } + var pipes = lang_1.isPresent(hostElementInjector) ? new pipes_1.Pipes(currView.proto.pipes, hostElementInjector.getInjector()) : null; + currView.changeDetector.hydrate(currView.context, currView.locals, currView, pipes); + viewIdx++; + } + } + }; + AppViewManagerUtils.prototype._populateViewLocals = function(view, elementInjector, boundElementIdx) { + if (lang_1.isPresent(elementInjector.getDirectiveVariableBindings())) { + collection_1.MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), function(directiveIndex, name) { + if (lang_1.isBlank(directiveIndex)) { + view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement); + } else { + view.locals.set(name, elementInjector.getDirectiveAtIndex(directiveIndex)); + } + }); + } + }; + AppViewManagerUtils.prototype._setUpEventEmitters = function(view, elementInjector, boundElementIndex) { + var emitters = elementInjector.getEventEmitterAccessors(); + for (var directiveIndex = 0; directiveIndex < emitters.length; ++directiveIndex) { + var directiveEmitters = emitters[directiveIndex]; + var directive = elementInjector.getDirectiveAtIndex(directiveIndex); + for (var eventIndex = 0; eventIndex < directiveEmitters.length; ++eventIndex) { + var eventEmitterAccessor = directiveEmitters[eventIndex]; + eventEmitterAccessor.subscribe(view, boundElementIndex, directive); + } + } + }; + AppViewManagerUtils.prototype.dehydrateView = function(initView) { + var endViewOffset = initView.viewOffset + initView.mainMergeMapping.nestedViewCountByViewIndex[initView.viewOffset]; + for (var viewIdx = initView.viewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = initView.views[viewIdx]; + if (currView.hydrated()) { + if (lang_1.isPresent(currView.locals)) { + currView.locals.clearValues(); + } + currView.context = null; + currView.changeDetector.dehydrate(); + var binders = currView.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var eli = initView.elementInjectors[currView.elementOffset + binderIdx]; + if (lang_1.isPresent(eli)) { + eli.dehydrate(); + } + } + } + } + }; + AppViewManagerUtils = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], AppViewManagerUtils); + return AppViewManagerUtils; + })(); + exports.AppViewManagerUtils = AppViewManagerUtils; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/change_detector_compiler", ["angular2/src/compiler/source_module", "angular2/src/core/change_detection/change_detection_jit_generator", "angular2/src/compiler/change_definition_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/transform/template_compiler/change_detector_codegen", "angular2/src/compiler/util", "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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var change_definition_factory_1 = require("angular2/src/compiler/change_definition_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var change_detector_codegen_1 = require("angular2/src/transform/template_compiler/change_detector_codegen"); + var util_1 = require("angular2/src/compiler/util"); + var di_1 = require("angular2/src/core/di"); + var ABSTRACT_CHANGE_DETECTOR = "AbstractChangeDetector"; + var UTIL = "ChangeDetectionUtil"; + var ABSTRACT_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/abstract_change_detector'); + var UTIL_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/change_detection_util'); + var PREGEN_PROTO_CHANGE_DETECTOR_MODULE = source_module_1.moduleRef('angular2/src/core/change_detection/pregen_proto_change_detector'); + var ChangeDetectionCompiler = (function() { + function ChangeDetectionCompiler(_genConfig) { + this._genConfig = _genConfig; + } + ChangeDetectionCompiler.prototype.compileComponentRuntime = function(componentType, strategy, parsedTemplate) { + var _this = this; + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + return changeDetectorDefinitions.map(function(definition) { + return _this._createChangeDetectorFactory(definition); + }); + }; + ChangeDetectionCompiler.prototype._createChangeDetectorFactory = function(definition) { + if (util_1.IS_DART) { + var proto = new change_detection_1.DynamicProtoChangeDetector(definition); + return function(dispatcher) { + return proto.instantiate(dispatcher); + }; + } else { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, UTIL, ABSTRACT_CHANGE_DETECTOR).generate(); + } + }; + ChangeDetectionCompiler.prototype.compileComponentCodeGen = function(componentType, strategy, parsedTemplate) { + var changeDetectorDefinitions = change_definition_factory_1.createChangeDetectorDefinitions(componentType, strategy, this._genConfig, parsedTemplate); + var factories = []; + var sourceParts = changeDetectorDefinitions.map(function(definition) { + var codegen; + if (util_1.IS_DART) { + codegen = new change_detector_codegen_1.Codegen(PREGEN_PROTO_CHANGE_DETECTOR_MODULE); + var className = definition.id; + codegen.generate(componentType.name, className, definition); + factories.push("(dispatcher) => new " + className + "(dispatcher)"); + return codegen.toString(); + } else { + codegen = new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, "" + UTIL_MODULE + UTIL, "" + ABSTRACT_CHANGE_DETECTOR_MODULE + ABSTRACT_CHANGE_DETECTOR); + factories.push("function(dispatcher) { return new " + codegen.typeName + "(dispatcher); }"); + return codegen.generateSource(); + } + }); + return new source_module_1.SourceExpressions(sourceParts, factories); + }; + ChangeDetectionCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorGenConfig])], ChangeDetectionCompiler); + return ChangeDetectionCompiler; + })(); + exports.ChangeDetectionCompiler = ChangeDetectionCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_parser", ["angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/change_detection", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_ast", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/compiler/template_preparser", "angular2/src/compiler/html_ast", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_ast_1 = require("angular2/src/compiler/template_ast"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var template_preparser_1 = require("angular2/src/compiler/template_preparser"); + var html_ast_1 = require("angular2/src/compiler/html_ast"); + var util_1 = require("angular2/src/compiler/util"); + var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(var-|#)|(on-)|(bindon-))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/g; + var TEMPLATE_ELEMENT = 'template'; + var TEMPLATE_ATTR = 'template'; + var TEMPLATE_ATTR_PREFIX = '*'; + var CLASS_ATTR = 'class'; + var PROPERTY_PARTS_SEPARATOR = new RegExp('\\.'); + var ATTRIBUTE_PREFIX = 'attr'; + var CLASS_PREFIX = 'class'; + var STYLE_PREFIX = 'style'; + var TEXT_CSS_SELECTOR = selector_1.CssSelector.parse('*')[0]; + var TemplateParser = (function() { + function TemplateParser(_exprParser, _schemaRegistry, _htmlParser) { + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this._htmlParser = _htmlParser; + } + TemplateParser.prototype.parse = function(template, directives, sourceInfo) { + var parseVisitor = new TemplateParseVisitor(directives, this._exprParser, this._schemaRegistry); + var result = html_ast_1.htmlVisitAll(parseVisitor, this._htmlParser.parse(template, sourceInfo), EMPTY_COMPONENT); + if (parseVisitor.errors.length > 0) { + var errorString = parseVisitor.errors.join('\n'); + throw new exceptions_1.BaseException("Template parse errors:\n" + errorString); + } + return result; + }; + TemplateParser = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.Parser, element_schema_registry_1.ElementSchemaRegistry, html_parser_1.HtmlParser])], TemplateParser); + return TemplateParser; + })(); + exports.TemplateParser = TemplateParser; + var TemplateParseVisitor = (function() { + function TemplateParseVisitor(directives, _exprParser, _schemaRegistry) { + var _this = this; + this._exprParser = _exprParser; + this._schemaRegistry = _schemaRegistry; + this.errors = []; + this.directivesIndexByTypeId = new Map(); + this.selectorMatcher = new selector_1.SelectorMatcher(); + collection_1.ListWrapper.forEachWithIndex(directives, function(directive, index) { + var selector = selector_1.CssSelector.parse(directive.selector); + _this.selectorMatcher.addSelectables(selector, directive); + _this.directivesIndexByTypeId.set(directive.type.id, index); + }); + } + TemplateParseVisitor.prototype._reportError = function(message) { + this.errors.push(message); + }; + TemplateParseVisitor.prototype._parseInterpolation = function(value, sourceInfo) { + try { + return this._exprParser.parseInterpolation(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseAction = function(value, sourceInfo) { + try { + return this._exprParser.parseAction(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseBinding = function(value, sourceInfo) { + try { + return this._exprParser.parseBinding(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); + } + }; + TemplateParseVisitor.prototype._parseTemplateBindings = function(value, sourceInfo) { + try { + return this._exprParser.parseTemplateBindings(value, sourceInfo); + } catch (e) { + this._reportError("" + e); + return []; + } + }; + TemplateParseVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + var expr = this._parseInterpolation(ast.value, ast.sourceInfo); + if (lang_1.isPresent(expr)) { + return new template_ast_1.BoundTextAst(expr, ngContentIndex, ast.sourceInfo); + } else { + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + } + }; + TemplateParseVisitor.prototype.visitAttr = function(ast, contex) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + TemplateParseVisitor.prototype.visitElement = function(element, component) { + var _this = this; + var nodeName = element.name; + var preparsedElement = template_preparser_1.preparseElement(element); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var matchableAttrs = []; + var elementOrDirectiveProps = []; + var vars = []; + var events = []; + var templateElementOrDirectiveProps = []; + var templateVars = []; + var templateMatchableAttrs = []; + var hasInlineTemplates = false; + var attrs = []; + element.attrs.forEach(function(attr) { + matchableAttrs.push([attr.name, attr.value]); + var hasBinding = _this._parseAttr(attr, matchableAttrs, elementOrDirectiveProps, events, vars); + var hasTemplateBinding = _this._parseInlineTemplateBinding(attr, templateMatchableAttrs, templateElementOrDirectiveProps, templateVars); + if (!hasBinding && !hasTemplateBinding) { + attrs.push(_this.visitAttr(attr, null)); + } + if (hasTemplateBinding) { + hasInlineTemplates = true; + } + }); + var isTemplateElement = nodeName == TEMPLATE_ELEMENT; + var elementCssSelector = createElementCssSelector(nodeName, matchableAttrs); + var directives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, elementCssSelector), elementOrDirectiveProps, isTemplateElement ? [] : vars, element.sourceInfo); + var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, directives); + var children = html_ast_1.htmlVisitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, Component.create(directives)); + var elementNgContentIndex = hasInlineTemplates ? null : component.findNgContentIndex(elementCssSelector); + var parsedElement; + if (preparsedElement.type === template_preparser_1.PreparsedElementType.NG_CONTENT) { + parsedElement = new template_ast_1.NgContentAst(elementNgContentIndex, element.sourceInfo); + } else if (isTemplateElement) { + this._assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, events, element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst(attrs, vars, directives, children, elementNgContentIndex, element.sourceInfo); + } else { + this._assertOnlyOneComponent(directives, element.sourceInfo); + var elementExportAsVars = collection_1.ListWrapper.filter(vars, function(varAst) { + return varAst.value.length === 0; + }); + parsedElement = new template_ast_1.ElementAst(nodeName, attrs, elementProps, events, elementExportAsVars, directives, children, elementNgContentIndex, element.sourceInfo); + } + if (hasInlineTemplates) { + var templateCssSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs); + var templateDirectives = this._createDirectiveAsts(element.name, this._parseDirectives(this.selectorMatcher, templateCssSelector), templateElementOrDirectiveProps, [], element.sourceInfo); + var templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateDirectives); + this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectives, templateElementProps, [], element.sourceInfo); + parsedElement = new template_ast_1.EmbeddedTemplateAst([], templateVars, templateDirectives, [parsedElement], component.findNgContentIndex(templateCssSelector), element.sourceInfo); + } + return parsedElement; + }; + TemplateParseVisitor.prototype._parseInlineTemplateBinding = function(attr, targetMatchableAttrs, targetProps, targetVars) { + var templateBindingsSource = null; + if (attr.name == TEMPLATE_ATTR) { + templateBindingsSource = attr.value; + } else if (lang_1.StringWrapper.startsWith(attr.name, TEMPLATE_ATTR_PREFIX)) { + var key = lang_1.StringWrapper.substring(attr.name, TEMPLATE_ATTR_PREFIX.length); + templateBindingsSource = (attr.value.length == 0) ? key : key + ' ' + attr.value; + } + if (lang_1.isPresent(templateBindingsSource)) { + var bindings = this._parseTemplateBindings(templateBindingsSource, attr.sourceInfo); + for (var i = 0; i < bindings.length; i++) { + var binding = bindings[i]; + var dashCaseKey = util_1.camelCaseToDashCase(binding.key); + if (binding.keyIsVar) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(binding.key), binding.name, attr.sourceInfo)); + targetMatchableAttrs.push([dashCaseKey, binding.name]); + } else if (lang_1.isPresent(binding.expression)) { + this._parsePropertyAst(dashCaseKey, binding.expression, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else { + targetMatchableAttrs.push([dashCaseKey, '']); + } + } + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parseAttr = function(attr, targetMatchableAttrs, targetProps, targetEvents, targetVars) { + var attrName = this._normalizeAttributeName(attr.name); + var attrValue = attr.value; + var bindParts = lang_1.RegExpWrapper.firstMatch(BIND_NAME_REGEXP, attrName); + var hasBinding = false; + if (lang_1.isPresent(bindParts)) { + hasBinding = true; + if (lang_1.isPresent(bindParts[1])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[2])) { + var identifier = bindParts[5]; + this._parseVariable(identifier, attrValue, attr.sourceInfo, targetMatchableAttrs, targetVars); + } else if (lang_1.isPresent(bindParts[3])) { + this._parseEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[4])) { + this._parseProperty(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[5], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[6])) { + this._parseProperty(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + this._parseAssignmentEvent(bindParts[6], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } else if (lang_1.isPresent(bindParts[7])) { + this._parseProperty(bindParts[7], attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } else if (lang_1.isPresent(bindParts[8])) { + this._parseEvent(bindParts[8], attrValue, attr.sourceInfo, targetMatchableAttrs, targetEvents); + } + } else { + hasBinding = this._parsePropertyInterpolation(attrName, attrValue, attr.sourceInfo, targetMatchableAttrs, targetProps); + } + if (!hasBinding) { + this._parseLiteralAttr(attrName, attrValue, attr.sourceInfo, targetProps); + } + return hasBinding; + }; + TemplateParseVisitor.prototype._normalizeAttributeName = function(attrName) { + return lang_1.StringWrapper.startsWith(attrName, 'data-') ? lang_1.StringWrapper.substring(attrName, 5) : attrName; + }; + TemplateParseVisitor.prototype._parseVariable = function(identifier, value, sourceInfo, targetMatchableAttrs, targetVars) { + targetVars.push(new template_ast_1.VariableAst(util_1.dashCaseToCamelCase(identifier), value, sourceInfo)); + targetMatchableAttrs.push([identifier, value]); + }; + TemplateParseVisitor.prototype._parseProperty = function(name, expression, sourceInfo, targetMatchableAttrs, targetProps) { + this._parsePropertyAst(name, this._parseBinding(expression, sourceInfo), sourceInfo, targetMatchableAttrs, targetProps); + }; + TemplateParseVisitor.prototype._parsePropertyInterpolation = function(name, value, sourceInfo, targetMatchableAttrs, targetProps) { + var expr = this._parseInterpolation(value, sourceInfo); + if (lang_1.isPresent(expr)) { + this._parsePropertyAst(name, expr, sourceInfo, targetMatchableAttrs, targetProps); + return true; + } + return false; + }; + TemplateParseVisitor.prototype._parsePropertyAst = function(name, ast, sourceInfo, targetMatchableAttrs, targetProps) { + targetMatchableAttrs.push([name, ast.source]); + targetProps.push(new BoundElementOrDirectiveProperty(name, ast, false, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseAssignmentEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + this._parseEvent(name, expression + "=$event", sourceInfo, targetMatchableAttrs, targetEvents); + }; + TemplateParseVisitor.prototype._parseEvent = function(name, expression, sourceInfo, targetMatchableAttrs, targetEvents) { + var parts = util_1.splitAtColon(name, [null, name]); + var target = parts[0]; + var eventName = parts[1]; + targetEvents.push(new template_ast_1.BoundEventAst(util_1.dashCaseToCamelCase(eventName), target, this._parseAction(expression, sourceInfo), sourceInfo)); + }; + TemplateParseVisitor.prototype._parseLiteralAttr = function(name, value, sourceInfo, targetProps) { + targetProps.push(new BoundElementOrDirectiveProperty(util_1.dashCaseToCamelCase(name), this._exprParser.wrapLiteralPrimitive(value, sourceInfo), true, sourceInfo)); + }; + TemplateParseVisitor.prototype._parseDirectives = function(selectorMatcher, elementCssSelector) { + var _this = this; + var directives = []; + selectorMatcher.match(elementCssSelector, function(selector, directive) { + directives.push(directive); + }); + collection_1.ListWrapper.sort(directives, function(dir1, dir2) { + var dir1Comp = dir1.isComponent; + var dir2Comp = dir2.isComponent; + if (dir1Comp && !dir2Comp) { + return -1; + } else if (!dir1Comp && dir2Comp) { + return 1; + } else { + return _this.directivesIndexByTypeId.get(dir1.type.id) - _this.directivesIndexByTypeId.get(dir2.type.id); + } + }); + return directives; + }; + TemplateParseVisitor.prototype._createDirectiveAsts = function(elementName, directives, props, possibleExportAsVars, sourceInfo) { + var _this = this; + var matchedVariables = new Set(); + var directiveAsts = directives.map(function(directive) { + var hostProperties = []; + var hostEvents = []; + var directiveProperties = []; + _this._createDirectiveHostPropertyAsts(elementName, directive.hostProperties, sourceInfo, hostProperties); + _this._createDirectiveHostEventAsts(directive.hostListeners, sourceInfo, hostEvents); + _this._createDirectivePropertyAsts(directive.properties, props, directiveProperties); + var exportAsVars = []; + possibleExportAsVars.forEach(function(varAst) { + if ((varAst.value.length === 0 && directive.isComponent) || (directive.exportAs == varAst.value)) { + exportAsVars.push(varAst); + matchedVariables.add(varAst.name); + } + }); + return new template_ast_1.DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, exportAsVars, sourceInfo); + }); + possibleExportAsVars.forEach(function(varAst) { + if (varAst.value.length > 0 && !collection_1.SetWrapper.has(matchedVariables, varAst.name)) { + _this._reportError("There is no directive with \"exportAs\" set to \"" + varAst.value + "\" at " + varAst.sourceInfo); + } + }); + return directiveAsts; + }; + TemplateParseVisitor.prototype._createDirectiveHostPropertyAsts = function(elementName, hostProps, sourceInfo, targetPropertyAsts) { + var _this = this; + if (lang_1.isPresent(hostProps)) { + collection_1.StringMapWrapper.forEach(hostProps, function(expression, propName) { + var exprAst = _this._parseBinding(expression, sourceInfo); + targetPropertyAsts.push(_this._createElementPropertyAst(elementName, propName, exprAst, sourceInfo)); + }); + } + }; + TemplateParseVisitor.prototype._createDirectiveHostEventAsts = function(hostListeners, sourceInfo, targetEventAsts) { + var _this = this; + if (lang_1.isPresent(hostListeners)) { + collection_1.StringMapWrapper.forEach(hostListeners, function(expression, propName) { + _this._parseEvent(propName, expression, sourceInfo, [], targetEventAsts); + }); + } + }; + TemplateParseVisitor.prototype._createDirectivePropertyAsts = function(directiveProperties, boundProps, targetBoundDirectiveProps) { + if (lang_1.isPresent(directiveProperties)) { + var boundPropsByName = new Map(); + boundProps.forEach(function(boundProp) { + var key = util_1.dashCaseToCamelCase(boundProp.name); + var prevValue = boundPropsByName.get(boundProp.name); + if (lang_1.isBlank(prevValue) || prevValue.isLiteral) { + boundPropsByName.set(key, boundProp); + } + }); + collection_1.StringMapWrapper.forEach(directiveProperties, function(elProp, dirProp) { + elProp = util_1.dashCaseToCamelCase(elProp); + var boundProp = boundPropsByName.get(elProp); + if (lang_1.isPresent(boundProp)) { + targetBoundDirectiveProps.push(new template_ast_1.BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceInfo)); + } + }); + } + }; + TemplateParseVisitor.prototype._createElementPropertyAsts = function(elementName, props, directives) { + var _this = this; + var boundElementProps = []; + var boundDirectivePropsIndex = new Map(); + directives.forEach(function(directive) { + directive.properties.forEach(function(prop) { + boundDirectivePropsIndex.set(prop.templateName, prop); + }); + }); + props.forEach(function(prop) { + if (!prop.isLiteral && lang_1.isBlank(boundDirectivePropsIndex.get(prop.name))) { + boundElementProps.push(_this._createElementPropertyAst(elementName, prop.name, prop.expression, prop.sourceInfo)); + } + }); + return boundElementProps; + }; + TemplateParseVisitor.prototype._createElementPropertyAst = function(elementName, name, ast, sourceInfo) { + var unit = null; + var bindingType; + var boundPropertyName; + var parts = lang_1.StringWrapper.split(name, PROPERTY_PARTS_SEPARATOR); + if (parts.length === 1) { + boundPropertyName = this._schemaRegistry.getMappedPropName(util_1.dashCaseToCamelCase(parts[0])); + bindingType = template_ast_1.PropertyBindingType.Property; + if (!this._schemaRegistry.hasProperty(elementName, boundPropertyName)) { + this._reportError("Can't bind to '" + boundPropertyName + "' since it isn't a known native property in " + sourceInfo); + } + } else if (parts[0] == ATTRIBUTE_PREFIX) { + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Attribute; + } else if (parts[0] == CLASS_PREFIX) { + boundPropertyName = parts[1]; + bindingType = template_ast_1.PropertyBindingType.Class; + } else if (parts[0] == STYLE_PREFIX) { + unit = parts.length > 2 ? parts[2] : null; + boundPropertyName = util_1.dashCaseToCamelCase(parts[1]); + bindingType = template_ast_1.PropertyBindingType.Style; + } else { + this._reportError("Invalid property name " + name + " in " + sourceInfo); + bindingType = null; + } + return new template_ast_1.BoundElementPropertyAst(boundPropertyName, bindingType, ast, unit, sourceInfo); + }; + TemplateParseVisitor.prototype._findComponentDirectiveNames = function(directives) { + var componentTypeNames = []; + directives.forEach(function(directive) { + var typeName = directive.directive.type.name; + if (directive.directive.isComponent) { + componentTypeNames.push(typeName); + } + }); + return componentTypeNames; + }; + TemplateParseVisitor.prototype._assertOnlyOneComponent = function(directives, sourceInfo) { + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 1) { + this._reportError("More than one component: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + }; + TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function(directives, elementProps, events, sourceInfo) { + var _this = this; + var componentTypeNames = this._findComponentDirectiveNames(directives); + if (componentTypeNames.length > 0) { + this._reportError("Components on an embedded template: " + componentTypeNames.join(',') + " in " + sourceInfo); + } + elementProps.forEach(function(prop) { + _this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template in " + prop.sourceInfo); + }); + events.forEach(function(event) { + _this._reportError("Event binding " + event.name + " on an embedded template in " + event.sourceInfo); + }); + }; + return TemplateParseVisitor; + })(); + var NonBindableVisitor = (function() { + function NonBindableVisitor() {} + NonBindableVisitor.prototype.visitElement = function(ast, component) { + var preparsedElement = template_preparser_1.preparseElement(ast); + if (preparsedElement.type === template_preparser_1.PreparsedElementType.SCRIPT || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLE || preparsedElement.type === template_preparser_1.PreparsedElementType.STYLESHEET) { + return null; + } + var attrNameAndValues = ast.attrs.map(function(attrAst) { + return [attrAst.name, attrAst.value]; + }); + var selector = createElementCssSelector(ast.name, attrNameAndValues); + var ngContentIndex = component.findNgContentIndex(selector); + var children = html_ast_1.htmlVisitAll(this, ast.children, EMPTY_COMPONENT); + return new template_ast_1.ElementAst(ast.name, html_ast_1.htmlVisitAll(this, ast.attrs), [], [], [], [], children, ngContentIndex, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitAttr = function(ast, context) { + return new template_ast_1.AttrAst(ast.name, ast.value, ast.sourceInfo); + }; + NonBindableVisitor.prototype.visitText = function(ast, component) { + var ngContentIndex = component.findNgContentIndex(TEXT_CSS_SELECTOR); + return new template_ast_1.TextAst(ast.value, ngContentIndex, ast.sourceInfo); + }; + return NonBindableVisitor; + })(); + var BoundElementOrDirectiveProperty = (function() { + function BoundElementOrDirectiveProperty(name, expression, isLiteral, sourceInfo) { + this.name = name; + this.expression = expression; + this.isLiteral = isLiteral; + this.sourceInfo = sourceInfo; + } + return BoundElementOrDirectiveProperty; + })(); + var ParseError = (function() { + function ParseError(message, sourceInfo) { + this.message = message; + this.sourceInfo = sourceInfo; + } + return ParseError; + })(); + function splitClasses(classAttrValue) { + return lang_1.StringWrapper.split(classAttrValue.trim(), /\s+/g); + } + exports.splitClasses = splitClasses; + var Component = (function() { + function Component(ngContentIndexMatcher, wildcardNgContentIndex) { + this.ngContentIndexMatcher = ngContentIndexMatcher; + this.wildcardNgContentIndex = wildcardNgContentIndex; + } + Component.create = function(directives) { + if (directives.length === 0 || !directives[0].directive.isComponent) { + return EMPTY_COMPONENT; + } + var matcher = new selector_1.SelectorMatcher(); + var ngContentSelectors = directives[0].directive.template.ngContentSelectors; + var wildcardNgContentIndex = null; + for (var i = 0; i < ngContentSelectors.length; i++) { + var selector = ngContentSelectors[i]; + if (lang_1.StringWrapper.equals(selector, '*')) { + wildcardNgContentIndex = i; + } else { + matcher.addSelectables(selector_1.CssSelector.parse(ngContentSelectors[i]), i); + } + } + return new Component(matcher, wildcardNgContentIndex); + }; + Component.prototype.findNgContentIndex = function(selector) { + var ngContentIndices = []; + if (lang_1.isPresent(this.wildcardNgContentIndex)) { + ngContentIndices.push(this.wildcardNgContentIndex); + } + this.ngContentIndexMatcher.match(selector, function(selector, ngContentIndex) { + ngContentIndices.push(ngContentIndex); + }); + collection_1.ListWrapper.sort(ngContentIndices); + return ngContentIndices.length > 0 ? ngContentIndices[0] : null; + }; + return Component; + })(); + function createElementCssSelector(elementName, matchableAttrs) { + var cssSelector = new selector_1.CssSelector(); + cssSelector.setElement(elementName); + for (var i = 0; i < matchableAttrs.length; i++) { + var attrName = matchableAttrs[i][0].toLowerCase(); + var attrValue = matchableAttrs[i][1]; + cssSelector.addAttribute(attrName, attrValue); + if (attrName == CLASS_ATTR) { + var classes = splitClasses(attrValue); + classes.forEach(function(className) { + return cssSelector.addClassName(className); + }); + } + } + return cssSelector; + } + var EMPTY_COMPONENT = new Component(new selector_1.SelectorMatcher(), null); + var NON_BINDABLE_VISITOR = new NonBindableVisitor(); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compile_pipeline", ["angular2/src/core/facade/lang", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/compiler/compile_element", "angular2/src/core/render/dom/compiler/compile_control", "angular2/src/core/render/dom/view/proto_view_builder"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var compile_element_1 = require("angular2/src/core/render/dom/compiler/compile_element"); + var compile_control_1 = require("angular2/src/core/render/dom/compiler/compile_control"); + var proto_view_builder_1 = require("angular2/src/core/render/dom/view/proto_view_builder"); + var CompilePipeline = (function() { + function CompilePipeline(steps) { + this.steps = steps; + this._control = new compile_control_1.CompileControl(steps); + } + CompilePipeline.prototype.processStyles = function(styles) { + var _this = this; + return styles.map(function(style) { + _this.steps.forEach(function(step) { + style = step.processStyle(style); + }); + return style; + }); + }; + CompilePipeline.prototype.processElements = function(rootElement, protoViewType, viewDef) { + var results = []; + var compilationCtxtDescription = viewDef.componentId; + var rootCompileElement = new compile_element_1.CompileElement(rootElement, compilationCtxtDescription); + rootCompileElement.inheritedProtoView = new proto_view_builder_1.ProtoViewBuilder(rootElement, protoViewType, viewDef.encapsulation); + rootCompileElement.isViewRoot = true; + this._processElement(results, null, rootCompileElement, compilationCtxtDescription); + return results; + }; + CompilePipeline.prototype._processElement = function(results, parent, current, compilationCtxtDescription) { + if (compilationCtxtDescription === void 0) { + compilationCtxtDescription = ''; + } + var additionalChildren = this._control.internalProcess(results, 0, parent, current); + if (current.compileChildren) { + var node = dom_adapter_1.DOM.firstChild(dom_adapter_1.DOM.templateAwareRoot(current.element)); + while (lang_1.isPresent(node)) { + var nextNode = dom_adapter_1.DOM.nextSibling(node); + if (dom_adapter_1.DOM.isElementNode(node)) { + var childCompileElement = new compile_element_1.CompileElement(node, compilationCtxtDescription); + childCompileElement.inheritedProtoView = current.inheritedProtoView; + childCompileElement.inheritedElementBinder = current.inheritedElementBinder; + childCompileElement.distanceToInheritedBinder = current.distanceToInheritedBinder + 1; + this._processElement(results, current, childCompileElement); + } + node = nextNode; + } + } + if (lang_1.isPresent(additionalChildren)) { + for (var i = 0; i < additionalChildren.length; i++) { + this._processElement(results, current, additionalChildren[i]); + } + } + }; + return CompilePipeline; + })(); + exports.CompilePipeline = CompilePipeline; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/css_animation_builder", ["angular2/src/animate/css_animation_options", "angular2/src/animate/animation"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var css_animation_options_1 = require("angular2/src/animate/css_animation_options"); + var animation_1 = require("angular2/src/animate/animation"); + var CssAnimationBuilder = (function() { + function CssAnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + this.data = new css_animation_options_1.CssAnimationOptions(); + } + CssAnimationBuilder.prototype.addAnimationClass = function(className) { + this.data.animationClasses.push(className); + return this; + }; + CssAnimationBuilder.prototype.addClass = function(className) { + this.data.classesToAdd.push(className); + return this; + }; + CssAnimationBuilder.prototype.removeClass = function(className) { + this.data.classesToRemove.push(className); + return this; + }; + CssAnimationBuilder.prototype.setDuration = function(duration) { + this.data.duration = duration; + return this; + }; + CssAnimationBuilder.prototype.setDelay = function(delay) { + this.data.delay = delay; + return this; + }; + CssAnimationBuilder.prototype.setStyles = function(from, to) { + return this.setFromStyles(from).setToStyles(to); + }; + CssAnimationBuilder.prototype.setFromStyles = function(from) { + this.data.fromStyles = from; + return this; + }; + CssAnimationBuilder.prototype.setToStyles = function(to) { + this.data.toStyles = to; + return this; + }; + CssAnimationBuilder.prototype.start = function(element) { + return new animation_1.Animation(element, this.data, this.browserDetails); + }; + return CssAnimationBuilder; + })(); + exports.CssAnimationBuilder = CssAnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/directives", ["angular2/src/core/facade/lang", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/ng_class", "angular2/src/core/directives/ng_for", "angular2/src/core/directives/ng_if", "angular2/src/core/directives/ng_non_bindable", "angular2/src/core/directives/ng_style", "angular2/src/core/directives/ng_switch", "angular2/src/core/directives/observable_list_diff"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var lang_1 = require("angular2/src/core/facade/lang"); + var ng_class_1 = require("angular2/src/core/directives/ng_class"); + var ng_for_1 = require("angular2/src/core/directives/ng_for"); + var ng_if_1 = require("angular2/src/core/directives/ng_if"); + var ng_non_bindable_1 = require("angular2/src/core/directives/ng_non_bindable"); + var ng_style_1 = require("angular2/src/core/directives/ng_style"); + var ng_switch_1 = require("angular2/src/core/directives/ng_switch"); + var ng_class_2 = require("angular2/src/core/directives/ng_class"); + exports.NgClass = ng_class_2.NgClass; + var ng_for_2 = require("angular2/src/core/directives/ng_for"); + exports.NgFor = ng_for_2.NgFor; + var ng_if_2 = require("angular2/src/core/directives/ng_if"); + exports.NgIf = ng_if_2.NgIf; + var ng_non_bindable_2 = require("angular2/src/core/directives/ng_non_bindable"); + exports.NgNonBindable = ng_non_bindable_2.NgNonBindable; + var ng_style_2 = require("angular2/src/core/directives/ng_style"); + exports.NgStyle = ng_style_2.NgStyle; + var ng_switch_2 = require("angular2/src/core/directives/ng_switch"); + exports.NgSwitch = ng_switch_2.NgSwitch; + exports.NgSwitchWhen = ng_switch_2.NgSwitchWhen; + exports.NgSwitchDefault = ng_switch_2.NgSwitchDefault; + __export(require("angular2/src/core/directives/observable_list_diff")); + exports.CORE_DIRECTIVES = lang_1.CONST_EXPR([ng_class_1.NgClass, ng_for_1.NgFor, ng_if_1.NgIf, ng_non_bindable_1.NgNonBindable, ng_style_1.NgStyle, ng_switch_1.NgSwitch, ng_switch_1.NgSwitchWhen, ng_switch_1.NgSwitchDefault]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/forms", ["angular2/src/core/forms/model", "angular2/src/core/forms/directives/abstract_control_directive", "angular2/src/core/forms/directives/control_container", "angular2/src/core/forms/directives/ng_control_name", "angular2/src/core/forms/directives/ng_form_control", "angular2/src/core/forms/directives/ng_model", "angular2/src/core/forms/directives/ng_control", "angular2/src/core/forms/directives/ng_control_group", "angular2/src/core/forms/directives/ng_form_model", "angular2/src/core/forms/directives/ng_form", "angular2/src/core/forms/directives/default_value_accessor", "angular2/src/core/forms/directives/checkbox_value_accessor", "angular2/src/core/forms/directives/select_control_value_accessor", "angular2/src/core/forms/directives", "angular2/src/core/forms/validators", "angular2/src/core/forms/directives/validators", "angular2/src/core/forms/form_builder", "angular2/src/core/forms/form_builder", "angular2/src/core/facade/lang"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var model_1 = require("angular2/src/core/forms/model"); + exports.AbstractControl = model_1.AbstractControl; + exports.Control = model_1.Control; + exports.ControlGroup = model_1.ControlGroup; + exports.ControlArray = model_1.ControlArray; + var abstract_control_directive_1 = require("angular2/src/core/forms/directives/abstract_control_directive"); + exports.AbstractControlDirective = abstract_control_directive_1.AbstractControlDirective; + var control_container_1 = require("angular2/src/core/forms/directives/control_container"); + exports.ControlContainer = control_container_1.ControlContainer; + var ng_control_name_1 = require("angular2/src/core/forms/directives/ng_control_name"); + exports.NgControlName = ng_control_name_1.NgControlName; + var ng_form_control_1 = require("angular2/src/core/forms/directives/ng_form_control"); + exports.NgFormControl = ng_form_control_1.NgFormControl; + var ng_model_1 = require("angular2/src/core/forms/directives/ng_model"); + exports.NgModel = ng_model_1.NgModel; + var ng_control_1 = require("angular2/src/core/forms/directives/ng_control"); + exports.NgControl = ng_control_1.NgControl; + var ng_control_group_1 = require("angular2/src/core/forms/directives/ng_control_group"); + exports.NgControlGroup = ng_control_group_1.NgControlGroup; + var ng_form_model_1 = require("angular2/src/core/forms/directives/ng_form_model"); + exports.NgFormModel = ng_form_model_1.NgFormModel; + var ng_form_1 = require("angular2/src/core/forms/directives/ng_form"); + exports.NgForm = ng_form_1.NgForm; + var default_value_accessor_1 = require("angular2/src/core/forms/directives/default_value_accessor"); + exports.DefaultValueAccessor = default_value_accessor_1.DefaultValueAccessor; + var checkbox_value_accessor_1 = require("angular2/src/core/forms/directives/checkbox_value_accessor"); + exports.CheckboxControlValueAccessor = checkbox_value_accessor_1.CheckboxControlValueAccessor; + var select_control_value_accessor_1 = require("angular2/src/core/forms/directives/select_control_value_accessor"); + exports.NgSelectOption = select_control_value_accessor_1.NgSelectOption; + exports.SelectControlValueAccessor = select_control_value_accessor_1.SelectControlValueAccessor; + var directives_1 = require("angular2/src/core/forms/directives"); + exports.FORM_DIRECTIVES = directives_1.FORM_DIRECTIVES; + var validators_1 = require("angular2/src/core/forms/validators"); + exports.NG_VALIDATORS = validators_1.NG_VALIDATORS; + exports.Validators = validators_1.Validators; + var validators_2 = require("angular2/src/core/forms/directives/validators"); + exports.DefaultValidators = validators_2.DefaultValidators; + var form_builder_1 = require("angular2/src/core/forms/form_builder"); + exports.FormBuilder = form_builder_1.FormBuilder; + var form_builder_2 = require("angular2/src/core/forms/form_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + exports.FORM_BINDINGS = lang_1.CONST_EXPR([form_builder_2.FormBuilder]); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/shared/client_message_broker", ["angular2/src/web_workers/shared/message_bus", "angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/web_workers/shared/serializer", "angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var lang_1 = require("angular2/src/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var di_1 = require("angular2/src/core/di"); + var lang_2 = require("angular2/src/core/facade/lang"); + var lang_3 = require("angular2/src/core/facade/lang"); + exports.Type = lang_3.Type; + var ClientMessageBrokerFactory = (function() { + function ClientMessageBrokerFactory(_messageBus, _serializer) { + this._messageBus = _messageBus; + this._serializer = _serializer; + } + ClientMessageBrokerFactory.prototype.createMessageBroker = function(channel, runInZone) { + if (runInZone === void 0) { + runInZone = true; + } + this._messageBus.initChannel(channel, runInZone); + return new ClientMessageBroker(this._messageBus, this._serializer, channel); + }; + ClientMessageBrokerFactory = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [message_bus_1.MessageBus, serializer_1.Serializer])], ClientMessageBrokerFactory); + return ClientMessageBrokerFactory; + })(); + exports.ClientMessageBrokerFactory = ClientMessageBrokerFactory; + var ClientMessageBroker = (function() { + function ClientMessageBroker(messageBus, _serializer, channel) { + var _this = this; + this._serializer = _serializer; + this.channel = channel; + this._pending = new Map(); + this._sink = messageBus.to(channel); + var source = messageBus.from(channel); + async_1.ObservableWrapper.subscribe(source, function(message) { + return _this._handleMessage(message); + }); + } + ClientMessageBroker.prototype._generateMessageId = function(name) { + var time = lang_1.stringify(lang_1.DateWrapper.toMillis(lang_1.DateWrapper.now())); + var iteration = 0; + var id = name + time + lang_1.stringify(iteration); + while (lang_1.isPresent(this._pending[id])) { + id = "" + name + time + iteration; + iteration++; + } + return id; + }; + ClientMessageBroker.prototype.runOnService = function(args, returnType) { + var _this = this; + var fnArgs = []; + if (lang_1.isPresent(args.args)) { + collection_1.ListWrapper.forEach(args.args, function(argument) { + if (argument.type != null) { + fnArgs.push(_this._serializer.serialize(argument.value, argument.type)); + } else { + fnArgs.push(argument.value); + } + }); + } + var promise; + var id = null; + if (returnType != null) { + var completer = async_1.PromiseWrapper.completer(); + id = this._generateMessageId(args.method); + this._pending.set(id, completer); + async_1.PromiseWrapper.catchError(completer.promise, function(err, stack) { + lang_1.print(err); + completer.reject(err, stack); + }); + promise = async_1.PromiseWrapper.then(completer.promise, function(value) { + if (_this._serializer == null) { + return value; + } else { + return _this._serializer.deserialize(value, returnType); + } + }); + } else { + promise = null; + } + var message = { + 'method': args.method, + 'args': fnArgs + }; + if (id != null) { + message['id'] = id; + } + async_1.ObservableWrapper.callNext(this._sink, message); + return promise; + }; + ClientMessageBroker.prototype._handleMessage = function(message) { + var data = new MessageData(message); + if (lang_2.StringWrapper.equals(data.type, "result") || lang_2.StringWrapper.equals(data.type, "error")) { + var id = data.id; + if (this._pending.has(id)) { + if (lang_2.StringWrapper.equals(data.type, "result")) { + this._pending.get(id).resolve(data.value); + } else { + this._pending.get(id).reject(data.value, null); + } + this._pending.delete(id); + } + } + }; + return ClientMessageBroker; + })(); + exports.ClientMessageBroker = ClientMessageBroker; + var MessageData = (function() { + function MessageData(data) { + this.type = collection_1.StringMapWrapper.get(data, "type"); + this.id = this._getValueIfPresent(data, "id"); + this.value = this._getValueIfPresent(data, "value"); + } + MessageData.prototype._getValueIfPresent = function(data, key) { + if (collection_1.StringMapWrapper.contains(data, key)) { + return collection_1.StringMapWrapper.get(data, key); + } else { + return null; + } + }; + return MessageData; + })(); + var FnArg = (function() { + function FnArg(value, type) { + this.value = value; + this.type = type; + } + return FnArg; + })(); + exports.FnArg = FnArg; + var UiArguments = (function() { + function UiArguments(method, args) { + this.method = method; + this.args = args; + } + return UiArguments; + })(); + exports.UiArguments = UiArguments; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/renderer", ["angular2/src/core/render/api", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/web_workers/shared/render_view_with_fragments_store", "angular2/src/web_workers/shared/api", "angular2/src/web_workers/shared/messaging_api", "angular2/src/web_workers/worker/event_dispatcher"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var api_1 = require("angular2/src/core/render/api"); + var client_message_broker_1 = require("angular2/src/web_workers/shared/client_message_broker"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var event_dispatcher_1 = require("angular2/src/web_workers/worker/event_dispatcher"); + var WebWorkerCompiler = (function() { + function WebWorkerCompiler(messageBrokerFactory) { + this._messageBroker = messageBrokerFactory.createMessageBroker(messaging_api_1.RENDER_COMPILER_CHANNEL); + } + WebWorkerCompiler.prototype.compileHost = function(directiveMetadata) { + var fnArgs = [new client_message_broker_1.FnArg(directiveMetadata, api_1.RenderDirectiveMetadata)]; + var args = new client_message_broker_1.UiArguments("compileHost", fnArgs); + return this._messageBroker.runOnService(args, api_1.ProtoViewDto); + }; + WebWorkerCompiler.prototype.compile = function(view) { + var fnArgs = [new client_message_broker_1.FnArg(view, api_1.ViewDefinition)]; + var args = new client_message_broker_1.UiArguments("compile", fnArgs); + return this._messageBroker.runOnService(args, api_1.ProtoViewDto); + }; + WebWorkerCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + var fnArgs = [new client_message_broker_1.FnArg(protoViewRefs, api_1.RenderProtoViewRef)]; + var args = new client_message_broker_1.UiArguments("mergeProtoViewsRecursively", fnArgs); + return this._messageBroker.runOnService(args, api_1.RenderProtoViewMergeMapping); + }; + WebWorkerCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [client_message_broker_1.ClientMessageBrokerFactory])], WebWorkerCompiler); + return WebWorkerCompiler; + })(); + exports.WebWorkerCompiler = WebWorkerCompiler; + var WebWorkerRenderer = (function() { + function WebWorkerRenderer(messageBrokerFactory, _renderViewStore, _eventDispatcher) { + this._renderViewStore = _renderViewStore; + this._eventDispatcher = _eventDispatcher; + this._messageBroker = messageBrokerFactory.createMessageBroker(messaging_api_1.RENDERER_CHANNEL); + } + WebWorkerRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + return this._createViewHelper(hostProtoViewRef, fragmentCount, hostElementSelector); + }; + WebWorkerRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + return this._createViewHelper(protoViewRef, fragmentCount); + }; + WebWorkerRenderer.prototype._createViewHelper = function(protoViewRef, fragmentCount, hostElementSelector) { + var renderViewWithFragments = this._renderViewStore.allocate(fragmentCount); + var startIndex = (renderViewWithFragments.viewRef).refNumber; + var fnArgs = [new client_message_broker_1.FnArg(protoViewRef, api_1.RenderProtoViewRef), new client_message_broker_1.FnArg(fragmentCount, null)]; + var method = "createView"; + if (lang_1.isPresent(hostElementSelector) && hostElementSelector != null) { + fnArgs.push(new client_message_broker_1.FnArg(hostElementSelector, null)); + method = "createRootHostView"; + } + fnArgs.push(new client_message_broker_1.FnArg(startIndex, null)); + var args = new client_message_broker_1.UiArguments(method, fnArgs); + this._messageBroker.runOnService(args, null); + return renderViewWithFragments; + }; + WebWorkerRenderer.prototype.destroyView = function(viewRef) { + var fnArgs = [new client_message_broker_1.FnArg(viewRef, api_1.RenderViewRef)]; + var args = new client_message_broker_1.UiArguments("destroyView", fnArgs); + this._messageBroker.runOnService(args, null); + this._renderViewStore.remove(viewRef); + }; + WebWorkerRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var fnArgs = [new client_message_broker_1.FnArg(previousFragmentRef, api_1.RenderFragmentRef), new client_message_broker_1.FnArg(fragmentRef, api_1.RenderFragmentRef)]; + var args = new client_message_broker_1.UiArguments("attachFragmentAfterFragment", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + var fnArgs = [new client_message_broker_1.FnArg(elementRef, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(fragmentRef, api_1.RenderFragmentRef)]; + var args = new client_message_broker_1.UiArguments("attachFragmentAfterElement", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.detachFragment = function(fragmentRef) { + var fnArgs = [new client_message_broker_1.FnArg(fragmentRef, api_1.RenderFragmentRef)]; + var args = new client_message_broker_1.UiArguments("detachFragment", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.hydrateView = function(viewRef) { + var fnArgs = [new client_message_broker_1.FnArg(viewRef, api_1.RenderViewRef)]; + var args = new client_message_broker_1.UiArguments("hydrateView", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.dehydrateView = function(viewRef) { + var fnArgs = [new client_message_broker_1.FnArg(viewRef, api_1.RenderViewRef)]; + var args = new client_message_broker_1.UiArguments("dehydrateView", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.getNativeElementSync = function(location) { + return null; + }; + WebWorkerRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + var fnArgs = [new client_message_broker_1.FnArg(location, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(propertyName, null), new client_message_broker_1.FnArg(propertyValue, null)]; + var args = new client_message_broker_1.UiArguments("setElementProperty", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + var fnArgs = [new client_message_broker_1.FnArg(location, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(attributeName, null), new client_message_broker_1.FnArg(attributeValue, null)]; + var args = new client_message_broker_1.UiArguments("setElementAttribute", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.setElementClass = function(location, className, isAdd) { + var fnArgs = [new client_message_broker_1.FnArg(location, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(className, null), new client_message_broker_1.FnArg(isAdd, null)]; + var args = new client_message_broker_1.UiArguments("setElementClass", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + var fnArgs = [new client_message_broker_1.FnArg(location, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(styleName, null), new client_message_broker_1.FnArg(styleValue, null)]; + var args = new client_message_broker_1.UiArguments("setElementStyle", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + var fnArgs = [new client_message_broker_1.FnArg(location, api_2.WebWorkerElementRef), new client_message_broker_1.FnArg(methodName, null), new client_message_broker_1.FnArg(args, null)]; + var uiArgs = new client_message_broker_1.UiArguments("invokeElementMethod", fnArgs); + this._messageBroker.runOnService(uiArgs, null); + }; + WebWorkerRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + var fnArgs = [new client_message_broker_1.FnArg(viewRef, api_1.RenderViewRef), new client_message_broker_1.FnArg(textNodeIndex, null), new client_message_broker_1.FnArg(text, null)]; + var args = new client_message_broker_1.UiArguments("setText", fnArgs); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var fnArgs = [new client_message_broker_1.FnArg(viewRef, api_1.RenderViewRef)]; + var args = new client_message_broker_1.UiArguments("setEventDispatcher", fnArgs); + this._eventDispatcher.registerEventDispatcher(viewRef, dispatcher); + this._messageBroker.runOnService(args, null); + }; + WebWorkerRenderer = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [client_message_broker_1.ClientMessageBrokerFactory, render_view_with_fragments_store_1.RenderViewWithFragmentsStore, event_dispatcher_1.WebWorkerEventDispatcher])], WebWorkerRenderer); + return WebWorkerRenderer; + })(); + exports.WebWorkerRenderer = WebWorkerRenderer; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di/injector", ["angular2/src/core/facade/collection", "angular2/src/core/di/binding", "angular2/src/core/di/exceptions", "angular2/src/core/facade/lang", "angular2/src/core/di/key", "angular2/src/core/di/metadata"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var collection_1 = require("angular2/src/core/facade/collection"); + var binding_1 = require("angular2/src/core/di/binding"); + var exceptions_1 = require("angular2/src/core/di/exceptions"); + var lang_1 = require("angular2/src/core/facade/lang"); + var key_1 = require("angular2/src/core/di/key"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var _MAX_CONSTRUCTION_COUNTER = 10; + exports.UNDEFINED = lang_1.CONST_EXPR(new Object()); + (function(Visibility) { + Visibility[Visibility["Public"] = 0] = "Public"; + Visibility[Visibility["Private"] = 1] = "Private"; + Visibility[Visibility["PublicAndPrivate"] = 2] = "PublicAndPrivate"; + })(exports.Visibility || (exports.Visibility = {})); + var Visibility = exports.Visibility; + function canSee(src, dst) { + return (src === dst) || (dst === Visibility.PublicAndPrivate || src === Visibility.PublicAndPrivate); + } + var ProtoInjectorInlineStrategy = (function() { + function ProtoInjectorInlineStrategy(protoEI, bwv) { + this.binding0 = null; + this.binding1 = null; + this.binding2 = null; + this.binding3 = null; + this.binding4 = null; + this.binding5 = null; + this.binding6 = null; + this.binding7 = null; + this.binding8 = null; + this.binding9 = null; + this.keyId0 = null; + this.keyId1 = null; + this.keyId2 = null; + this.keyId3 = null; + this.keyId4 = null; + this.keyId5 = null; + this.keyId6 = null; + this.keyId7 = null; + this.keyId8 = null; + this.keyId9 = null; + this.visibility0 = null; + this.visibility1 = null; + this.visibility2 = null; + this.visibility3 = null; + this.visibility4 = null; + this.visibility5 = null; + this.visibility6 = null; + this.visibility7 = null; + this.visibility8 = null; + this.visibility9 = null; + var length = bwv.length; + if (length > 0) { + this.binding0 = bwv[0].binding; + this.keyId0 = bwv[0].getKeyId(); + this.visibility0 = bwv[0].visibility; + } + if (length > 1) { + this.binding1 = bwv[1].binding; + this.keyId1 = bwv[1].getKeyId(); + this.visibility1 = bwv[1].visibility; + } + if (length > 2) { + this.binding2 = bwv[2].binding; + this.keyId2 = bwv[2].getKeyId(); + this.visibility2 = bwv[2].visibility; + } + if (length > 3) { + this.binding3 = bwv[3].binding; + this.keyId3 = bwv[3].getKeyId(); + this.visibility3 = bwv[3].visibility; + } + if (length > 4) { + this.binding4 = bwv[4].binding; + this.keyId4 = bwv[4].getKeyId(); + this.visibility4 = bwv[4].visibility; + } + if (length > 5) { + this.binding5 = bwv[5].binding; + this.keyId5 = bwv[5].getKeyId(); + this.visibility5 = bwv[5].visibility; + } + if (length > 6) { + this.binding6 = bwv[6].binding; + this.keyId6 = bwv[6].getKeyId(); + this.visibility6 = bwv[6].visibility; + } + if (length > 7) { + this.binding7 = bwv[7].binding; + this.keyId7 = bwv[7].getKeyId(); + this.visibility7 = bwv[7].visibility; + } + if (length > 8) { + this.binding8 = bwv[8].binding; + this.keyId8 = bwv[8].getKeyId(); + this.visibility8 = bwv[8].visibility; + } + if (length > 9) { + this.binding9 = bwv[9].binding; + this.keyId9 = bwv[9].getKeyId(); + this.visibility9 = bwv[9].visibility; + } + } + ProtoInjectorInlineStrategy.prototype.getBindingAtIndex = function(index) { + if (index == 0) + return this.binding0; + if (index == 1) + return this.binding1; + if (index == 2) + return this.binding2; + if (index == 3) + return this.binding3; + if (index == 4) + return this.binding4; + if (index == 5) + return this.binding5; + if (index == 6) + return this.binding6; + if (index == 7) + return this.binding7; + if (index == 8) + return this.binding8; + if (index == 9) + return this.binding9; + throw new exceptions_1.OutOfBoundsError(index); + }; + ProtoInjectorInlineStrategy.prototype.createInjectorStrategy = function(injector) { + return new InjectorInlineStrategy(injector, this); + }; + return ProtoInjectorInlineStrategy; + })(); + exports.ProtoInjectorInlineStrategy = ProtoInjectorInlineStrategy; + var ProtoInjectorDynamicStrategy = (function() { + function ProtoInjectorDynamicStrategy(protoInj, bwv) { + var len = bwv.length; + this.bindings = collection_1.ListWrapper.createFixedSize(len); + this.keyIds = collection_1.ListWrapper.createFixedSize(len); + this.visibilities = collection_1.ListWrapper.createFixedSize(len); + for (var i = 0; i < len; i++) { + this.bindings[i] = bwv[i].binding; + this.keyIds[i] = bwv[i].getKeyId(); + this.visibilities[i] = bwv[i].visibility; + } + } + ProtoInjectorDynamicStrategy.prototype.getBindingAtIndex = function(index) { + if (index < 0 || index >= this.bindings.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.bindings[index]; + }; + ProtoInjectorDynamicStrategy.prototype.createInjectorStrategy = function(ei) { + return new InjectorDynamicStrategy(this, ei); + }; + return ProtoInjectorDynamicStrategy; + })(); + exports.ProtoInjectorDynamicStrategy = ProtoInjectorDynamicStrategy; + var ProtoInjector = (function() { + function ProtoInjector(bwv) { + this.numberOfBindings = bwv.length; + this._strategy = bwv.length > _MAX_CONSTRUCTION_COUNTER ? new ProtoInjectorDynamicStrategy(this, bwv) : new ProtoInjectorInlineStrategy(this, bwv); + } + ProtoInjector.prototype.getBindingAtIndex = function(index) { + return this._strategy.getBindingAtIndex(index); + }; + return ProtoInjector; + })(); + exports.ProtoInjector = ProtoInjector; + var InjectorInlineStrategy = (function() { + function InjectorInlineStrategy(injector, protoStrategy) { + this.injector = injector; + this.protoStrategy = protoStrategy; + this.obj0 = exports.UNDEFINED; + this.obj1 = exports.UNDEFINED; + this.obj2 = exports.UNDEFINED; + this.obj3 = exports.UNDEFINED; + this.obj4 = exports.UNDEFINED; + this.obj5 = exports.UNDEFINED; + this.obj6 = exports.UNDEFINED; + this.obj7 = exports.UNDEFINED; + this.obj8 = exports.UNDEFINED; + this.obj9 = exports.UNDEFINED; + } + InjectorInlineStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorInlineStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorInlineStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorInlineStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + var inj = this.injector; + if (p.keyId0 === keyId && canSee(p.visibility0, visibility)) { + if (this.obj0 === exports.UNDEFINED) { + this.obj0 = inj._new(p.binding0, p.visibility0); + } + return this.obj0; + } + if (p.keyId1 === keyId && canSee(p.visibility1, visibility)) { + if (this.obj1 === exports.UNDEFINED) { + this.obj1 = inj._new(p.binding1, p.visibility1); + } + return this.obj1; + } + if (p.keyId2 === keyId && canSee(p.visibility2, visibility)) { + if (this.obj2 === exports.UNDEFINED) { + this.obj2 = inj._new(p.binding2, p.visibility2); + } + return this.obj2; + } + if (p.keyId3 === keyId && canSee(p.visibility3, visibility)) { + if (this.obj3 === exports.UNDEFINED) { + this.obj3 = inj._new(p.binding3, p.visibility3); + } + return this.obj3; + } + if (p.keyId4 === keyId && canSee(p.visibility4, visibility)) { + if (this.obj4 === exports.UNDEFINED) { + this.obj4 = inj._new(p.binding4, p.visibility4); + } + return this.obj4; + } + if (p.keyId5 === keyId && canSee(p.visibility5, visibility)) { + if (this.obj5 === exports.UNDEFINED) { + this.obj5 = inj._new(p.binding5, p.visibility5); + } + return this.obj5; + } + if (p.keyId6 === keyId && canSee(p.visibility6, visibility)) { + if (this.obj6 === exports.UNDEFINED) { + this.obj6 = inj._new(p.binding6, p.visibility6); + } + return this.obj6; + } + if (p.keyId7 === keyId && canSee(p.visibility7, visibility)) { + if (this.obj7 === exports.UNDEFINED) { + this.obj7 = inj._new(p.binding7, p.visibility7); + } + return this.obj7; + } + if (p.keyId8 === keyId && canSee(p.visibility8, visibility)) { + if (this.obj8 === exports.UNDEFINED) { + this.obj8 = inj._new(p.binding8, p.visibility8); + } + return this.obj8; + } + if (p.keyId9 === keyId && canSee(p.visibility9, visibility)) { + if (this.obj9 === exports.UNDEFINED) { + this.obj9 = inj._new(p.binding9, p.visibility9); + } + return this.obj9; + } + return exports.UNDEFINED; + }; + InjectorInlineStrategy.prototype.getObjAtIndex = function(index) { + if (index == 0) + return this.obj0; + if (index == 1) + return this.obj1; + if (index == 2) + return this.obj2; + if (index == 3) + return this.obj3; + if (index == 4) + return this.obj4; + if (index == 5) + return this.obj5; + if (index == 6) + return this.obj6; + if (index == 7) + return this.obj7; + if (index == 8) + return this.obj8; + if (index == 9) + return this.obj9; + throw new exceptions_1.OutOfBoundsError(index); + }; + InjectorInlineStrategy.prototype.getMaxNumberOfObjects = function() { + return _MAX_CONSTRUCTION_COUNTER; + }; + return InjectorInlineStrategy; + })(); + exports.InjectorInlineStrategy = InjectorInlineStrategy; + var InjectorDynamicStrategy = (function() { + function InjectorDynamicStrategy(protoStrategy, injector) { + this.protoStrategy = protoStrategy; + this.injector = injector; + this.objs = collection_1.ListWrapper.createFixedSize(protoStrategy.bindings.length); + collection_1.ListWrapper.fill(this.objs, exports.UNDEFINED); + } + InjectorDynamicStrategy.prototype.resetConstructionCounter = function() { + this.injector._constructionCounter = 0; + }; + InjectorDynamicStrategy.prototype.instantiateBinding = function(binding, visibility) { + return this.injector._new(binding, visibility); + }; + InjectorDynamicStrategy.prototype.attach = function(parent, isHost) { + var inj = this.injector; + inj._parent = parent; + inj._isHost = isHost; + }; + InjectorDynamicStrategy.prototype.getObjByKeyId = function(keyId, visibility) { + var p = this.protoStrategy; + for (var i = 0; i < p.keyIds.length; i++) { + if (p.keyIds[i] === keyId && canSee(p.visibilities[i], visibility)) { + if (this.objs[i] === exports.UNDEFINED) { + this.objs[i] = this.injector._new(p.bindings[i], p.visibilities[i]); + } + return this.objs[i]; + } + } + return exports.UNDEFINED; + }; + InjectorDynamicStrategy.prototype.getObjAtIndex = function(index) { + if (index < 0 || index >= this.objs.length) { + throw new exceptions_1.OutOfBoundsError(index); + } + return this.objs[index]; + }; + InjectorDynamicStrategy.prototype.getMaxNumberOfObjects = function() { + return this.objs.length; + }; + return InjectorDynamicStrategy; + })(); + exports.InjectorDynamicStrategy = InjectorDynamicStrategy; + var BindingWithVisibility = (function() { + function BindingWithVisibility(binding, visibility) { + this.binding = binding; + this.visibility = visibility; + } + ; + BindingWithVisibility.prototype.getKeyId = function() { + return this.binding.key.id; + }; + return BindingWithVisibility; + })(); + exports.BindingWithVisibility = BindingWithVisibility; + var Injector = (function() { + function Injector(_proto, _parent, _depProvider, _debugContext) { + if (_parent === void 0) { + _parent = null; + } + if (_depProvider === void 0) { + _depProvider = null; + } + if (_debugContext === void 0) { + _debugContext = null; + } + this._proto = _proto; + this._parent = _parent; + this._depProvider = _depProvider; + this._debugContext = _debugContext; + this._isHost = false; + this._constructionCounter = 0; + this._strategy = _proto._strategy.createInjectorStrategy(this); + } + Injector.resolve = function(bindings) { + return binding_1.resolveBindings(bindings); + }; + Injector.resolveAndCreate = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return Injector.fromResolvedBindings(resolvedBindings); + }; + Injector.fromResolvedBindings = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + return new Injector(proto, null, null); + }; + Injector.prototype.debugContext = function() { + return this._debugContext(); + }; + Injector.prototype.get = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, false, Visibility.PublicAndPrivate); + }; + Injector.prototype.getOptional = function(token) { + return this._getByKey(key_1.Key.get(token), null, null, true, Visibility.PublicAndPrivate); + }; + Injector.prototype.getAt = function(index) { + return this._strategy.getObjAtIndex(index); + }; + Object.defineProperty(Injector.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(Injector.prototype, "internalStrategy", { + get: function() { + return this._strategy; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.resolveAndCreateChild = function(bindings) { + var resolvedBindings = Injector.resolve(bindings); + return this.createChildFromResolved(resolvedBindings); + }; + Injector.prototype.createChildFromResolved = function(bindings) { + var bd = bindings.map(function(b) { + return new BindingWithVisibility(b, Visibility.Public); + }); + var proto = new ProtoInjector(bd); + var inj = new Injector(proto, null, null); + inj._parent = this; + return inj; + }; + Injector.prototype.resolveAndInstantiate = function(binding) { + return this.instantiateResolved(Injector.resolve([binding])[0]); + }; + Injector.prototype.instantiateResolved = function(binding) { + return this._instantiateBinding(binding, Visibility.PublicAndPrivate); + }; + Injector.prototype._new = function(binding, visibility) { + if (this._constructionCounter++ > this._strategy.getMaxNumberOfObjects()) { + throw new exceptions_1.CyclicDependencyError(this, binding.key); + } + return this._instantiateBinding(binding, visibility); + }; + Injector.prototype._instantiateBinding = function(binding, visibility) { + if (binding.multiBinding) { + var res = collection_1.ListWrapper.createFixedSize(binding.resolvedFactories.length); + for (var i = 0; i < binding.resolvedFactories.length; ++i) { + res[i] = this._instantiate(binding, binding.resolvedFactories[i], visibility); + } + return res; + } else { + return this._instantiate(binding, binding.resolvedFactories[0], visibility); + } + }; + Injector.prototype._instantiate = function(binding, resolvedFactory, visibility) { + var factory = resolvedFactory.factory; + var deps = resolvedFactory.dependencies; + var length = deps.length; + var d0, + d1, + d2, + d3, + d4, + d5, + d6, + d7, + d8, + d9, + d10, + d11, + d12, + d13, + d14, + d15, + d16, + d17, + d18, + d19; + try { + d0 = length > 0 ? this._getByDependency(binding, deps[0], visibility) : null; + d1 = length > 1 ? this._getByDependency(binding, deps[1], visibility) : null; + d2 = length > 2 ? this._getByDependency(binding, deps[2], visibility) : null; + d3 = length > 3 ? this._getByDependency(binding, deps[3], visibility) : null; + d4 = length > 4 ? this._getByDependency(binding, deps[4], visibility) : null; + d5 = length > 5 ? this._getByDependency(binding, deps[5], visibility) : null; + d6 = length > 6 ? this._getByDependency(binding, deps[6], visibility) : null; + d7 = length > 7 ? this._getByDependency(binding, deps[7], visibility) : null; + d8 = length > 8 ? this._getByDependency(binding, deps[8], visibility) : null; + d9 = length > 9 ? this._getByDependency(binding, deps[9], visibility) : null; + d10 = length > 10 ? this._getByDependency(binding, deps[10], visibility) : null; + d11 = length > 11 ? this._getByDependency(binding, deps[11], visibility) : null; + d12 = length > 12 ? this._getByDependency(binding, deps[12], visibility) : null; + d13 = length > 13 ? this._getByDependency(binding, deps[13], visibility) : null; + d14 = length > 14 ? this._getByDependency(binding, deps[14], visibility) : null; + d15 = length > 15 ? this._getByDependency(binding, deps[15], visibility) : null; + d16 = length > 16 ? this._getByDependency(binding, deps[16], visibility) : null; + d17 = length > 17 ? this._getByDependency(binding, deps[17], visibility) : null; + d18 = length > 18 ? this._getByDependency(binding, deps[18], visibility) : null; + d19 = length > 19 ? this._getByDependency(binding, deps[19], visibility) : null; + } catch (e) { + if (e instanceof exceptions_1.AbstractBindingError || e instanceof exceptions_1.InstantiationError) { + e.addKey(this, binding.key); + } + throw e; + } + var obj; + try { + switch (length) { + case 0: + obj = factory(); + break; + case 1: + obj = factory(d0); + break; + case 2: + obj = factory(d0, d1); + break; + case 3: + obj = factory(d0, d1, d2); + break; + case 4: + obj = factory(d0, d1, d2, d3); + break; + case 5: + obj = factory(d0, d1, d2, d3, d4); + break; + case 6: + obj = factory(d0, d1, d2, d3, d4, d5); + break; + case 7: + obj = factory(d0, d1, d2, d3, d4, d5, d6); + break; + case 8: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7); + break; + case 9: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8); + break; + case 10: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9); + break; + case 11: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10); + break; + case 12: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11); + break; + case 13: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12); + break; + case 14: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13); + break; + case 15: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14); + break; + case 16: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15); + break; + case 17: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16); + break; + case 18: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17); + break; + case 19: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18); + break; + case 20: + obj = factory(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19); + break; + } + } catch (e) { + throw new exceptions_1.InstantiationError(this, e, e.stack, binding.key); + } + return obj; + }; + Injector.prototype._getByDependency = function(binding, dep, bindingVisibility) { + var special = lang_1.isPresent(this._depProvider) ? this._depProvider.getDependency(this, binding, dep) : exports.UNDEFINED; + if (special !== exports.UNDEFINED) { + return special; + } else { + return this._getByKey(dep.key, dep.lowerBoundVisibility, dep.upperBoundVisibility, dep.optional, bindingVisibility); + } + }; + Injector.prototype._getByKey = function(key, lowerBoundVisibility, upperBoundVisibility, optional, bindingVisibility) { + if (key === INJECTOR_KEY) { + return this; + } + if (upperBoundVisibility instanceof metadata_1.SelfMetadata) { + return this._getByKeySelf(key, optional, bindingVisibility); + } else if (upperBoundVisibility instanceof metadata_1.HostMetadata) { + return this._getByKeyHost(key, optional, bindingVisibility, lowerBoundVisibility); + } else { + return this._getByKeyDefault(key, optional, bindingVisibility, lowerBoundVisibility); + } + }; + Injector.prototype._throwOrNull = function(key, optional) { + if (optional) { + return null; + } else { + throw new exceptions_1.NoBindingError(this, key); + } + }; + Injector.prototype._getByKeySelf = function(key, optional, bindingVisibility) { + var obj = this._strategy.getObjByKeyId(key.id, bindingVisibility); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyHost = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + if (inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + if (lang_1.isPresent(inj._parent) && inj._isHost) { + return this._getPrivateDependency(key, optional, inj); + } else { + inj = inj._parent; + } + } + return this._throwOrNull(key, optional); + }; + Injector.prototype._getPrivateDependency = function(key, optional, inj) { + var obj = inj._parent._strategy.getObjByKeyId(key.id, Visibility.Private); + return (obj !== exports.UNDEFINED) ? obj : this._throwOrNull(key, optional); + }; + Injector.prototype._getByKeyDefault = function(key, optional, bindingVisibility, lowerBoundVisibility) { + var inj = this; + if (lowerBoundVisibility instanceof metadata_1.SkipSelfMetadata) { + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + while (inj != null) { + var obj = inj._strategy.getObjByKeyId(key.id, bindingVisibility); + if (obj !== exports.UNDEFINED) + return obj; + bindingVisibility = inj._isHost ? Visibility.PublicAndPrivate : Visibility.Public; + inj = inj._parent; + } + return this._throwOrNull(key, optional); + }; + Object.defineProperty(Injector.prototype, "displayName", { + get: function() { + return "Injector(bindings: [" + _mapBindings(this, function(b) { + return (" \"" + b.key.displayName + "\" "); + }).join(", ") + "])"; + }, + enumerable: true, + configurable: true + }); + Injector.prototype.toString = function() { + return this.displayName; + }; + return Injector; + })(); + exports.Injector = Injector; + var INJECTOR_KEY = key_1.Key.get(Injector); + function _mapBindings(injector, fn) { + var res = []; + for (var i = 0; i < injector._proto.numberOfBindings; ++i) { + res.push(fn(injector._proto.getBindingAtIndex(i))); + } + return res; + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/change_detection_jit_generator", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/change_detection/abstract_change_detector", "angular2/src/core/change_detection/change_detection_util", "angular2/src/core/change_detection/codegen_name_util", "angular2/src/core/change_detection/codegen_logic_util", "angular2/src/core/change_detection/codegen_facade", "angular2/src/core/change_detection/proto_change_detector"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var abstract_change_detector_1 = require("angular2/src/core/change_detection/abstract_change_detector"); + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + var codegen_name_util_1 = require("angular2/src/core/change_detection/codegen_name_util"); + var codegen_logic_util_1 = require("angular2/src/core/change_detection/codegen_logic_util"); + var codegen_facade_1 = require("angular2/src/core/change_detection/codegen_facade"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var IS_CHANGED_LOCAL = "isChanged"; + var CHANGES_LOCAL = "changes"; + var ChangeDetectorJITGenerator = (function() { + function ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) { + this.changeDetectionUtilVarName = changeDetectionUtilVarName; + this.abstractChangeDetectorVarName = abstractChangeDetectorVarName; + var propertyBindingRecords = proto_change_detector_1.createPropertyRecords(definition); + var eventBindingRecords = proto_change_detector_1.createEventRecords(definition); + var propertyBindingTargets = definition.bindingRecords.map(function(b) { + return b.target; + }); + this.id = definition.id; + this.changeDetectionStrategy = definition.strategy; + this.genConfig = definition.genConfig; + this.records = propertyBindingRecords; + this.propertyBindingTargets = propertyBindingTargets; + this.eventBindings = eventBindingRecords; + this.directiveRecords = definition.directiveRecords; + this._names = new codegen_name_util_1.CodegenNameUtil(this.records, this.eventBindings, this.directiveRecords, this.changeDetectionUtilVarName); + this._logic = new codegen_logic_util_1.CodegenLogicUtil(this._names, this.changeDetectionUtilVarName, this.changeDetectionStrategy); + this.typeName = codegen_name_util_1.sanitizeName("ChangeDetector_" + this.id); + } + ChangeDetectorJITGenerator.prototype.generate = function() { + var factorySource = "\n " + this.generateSource() + "\n return function(dispatcher) {\n return new " + this.typeName + "(dispatcher);\n }\n "; + return new Function(this.abstractChangeDetectorVarName, this.changeDetectionUtilVarName, factorySource)(abstract_change_detector_1.AbstractChangeDetector, change_detection_util_1.ChangeDetectionUtil); + }; + ChangeDetectorJITGenerator.prototype.generateSource = function() { + var _this = this; + return "\n var " + this.typeName + " = function " + this.typeName + "(dispatcher) {\n " + this.abstractChangeDetectorVarName + ".call(\n this, " + JSON.stringify(this.id) + ", dispatcher, " + this.records.length + ",\n " + this.typeName + ".gen_propertyBindingTargets, " + this.typeName + ".gen_directiveIndices,\n " + codegen_facade_1.codify(this.changeDetectionStrategy) + ");\n this.dehydrateDirectives(false);\n }\n\n " + this.typeName + ".prototype = Object.create(" + this.abstractChangeDetectorVarName + ".prototype);\n\n " + this.typeName + ".prototype.detectChangesInRecordsInternal = function(throwOnChange) {\n " + this._names.genInitLocals() + "\n var " + IS_CHANGED_LOCAL + " = false;\n var " + CHANGES_LOCAL + " = null;\n\n " + this.records.map(function(r) { + return _this._genRecord(r); + }).join("\n") + "\n }\n\n " + this._maybeGenHandleEventInternal() + "\n\n " + this._genCheckNoChanges() + "\n\n " + this._maybeGenAfterContentLifecycleCallbacks() + "\n\n " + this._maybeGenAfterViewLifecycleCallbacks() + "\n\n " + this._maybeGenHydrateDirectives() + "\n\n " + this._maybeGenDehydrateDirectives() + "\n\n " + this._genPropertyBindingTargets() + "\n\n " + this._genDirectiveIndices() + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genPropertyBindingTargets = function() { + var targets = this._logic.genPropertyBindingTargets(this.propertyBindingTargets, this.genConfig.genDebugInfo); + return this.typeName + ".gen_propertyBindingTargets = " + targets + ";"; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveIndices = function() { + var indices = this._logic.genDirectiveIndices(this.directiveRecords); + return this.typeName + ".gen_directiveIndices = " + indices + ";"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHandleEventInternal = function() { + var _this = this; + if (this.eventBindings.length > 0) { + var handlers = this.eventBindings.map(function(eb) { + return _this._genEventBinding(eb); + }).join("\n"); + return "\n " + this.typeName + ".prototype.handleEventInternal = function(eventName, elIndex, locals) {\n var " + this._names.getPreventDefaultAccesor() + " = false;\n " + this._names.genInitEventLocals() + "\n " + handlers + "\n return " + this._names.getPreventDefaultAccesor() + ";\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genEventBinding = function(eb) { + var _this = this; + var recs = eb.records.map(function(r) { + return _this._genEventBindingEval(eb, r); + }).join("\n"); + return "\n if (eventName === \"" + eb.eventName + "\" && elIndex === " + eb.elIndex + ") {\n " + recs + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._genEventBindingEval = function(eb, r) { + if (r.lastInBinding) { + var evalRecord = this._logic.genEventBindingEvalValue(eb, r); + var markPath = this._genMarkPathToRootAsCheckOnce(r); + var prevDefault = this._genUpdatePreventDefault(eb, r); + return evalRecord + "\n" + markPath + "\n" + prevDefault; + } else { + return this._logic.genEventBindingEvalValue(eb, r); + } + }; + ChangeDetectorJITGenerator.prototype._genMarkPathToRootAsCheckOnce = function(r) { + var br = r.bindingRecord; + if (br.isDefaultChangeDetection()) { + return ""; + } else { + return this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markPathToRootAsCheckOnce();"; + } + }; + ChangeDetectorJITGenerator.prototype._genUpdatePreventDefault = function(eb, r) { + var local = this._names.getEventLocalName(eb, r.selfIndex); + return "if (" + local + " === false) { " + this._names.getPreventDefaultAccesor() + " = true};"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenDehydrateDirectives = function() { + var destroyPipesCode = this._names.genPipeOnDestroy(); + if (destroyPipesCode) { + destroyPipesCode = "if (destroyPipes) { " + destroyPipesCode + " }"; + } + var dehydrateFieldsCode = this._names.genDehydrateFields(); + if (!destroyPipesCode && !dehydrateFieldsCode) + return ''; + return this.typeName + ".prototype.dehydrateDirectives = function(destroyPipes) {\n " + destroyPipesCode + "\n " + dehydrateFieldsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenHydrateDirectives = function() { + var hydrateDirectivesCode = this._logic.genHydrateDirectives(this.directiveRecords); + var hydrateDetectorsCode = this._logic.genHydrateDetectors(this.directiveRecords); + if (!hydrateDirectivesCode && !hydrateDetectorsCode) + return ''; + return this.typeName + ".prototype.hydrateDirectives = function(directives) {\n " + hydrateDirectivesCode + "\n " + hydrateDetectorsCode + "\n }"; + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterContentLifecycleCallbacks = function() { + var notifications = this._logic.genContentLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterContentLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._maybeGenAfterViewLifecycleCallbacks = function() { + var notifications = this._logic.genViewLifecycleCallbacks(this.directiveRecords); + if (notifications.length > 0) { + var directiveNotifications = notifications.join("\n"); + return "\n " + this.typeName + ".prototype.afterViewLifecycleCallbacksInternal = function() {\n " + directiveNotifications + "\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genRecord = function(r) { + var rec; + if (r.isLifeCycleRecord()) { + rec = this._genDirectiveLifecycle(r); + } else if (r.isPipeRecord()) { + rec = this._genPipeCheck(r); + } else { + rec = this._genReferenceCheck(r); + } + return "\n " + this._maybeFirstInBinding(r) + "\n " + rec + "\n " + this._maybeGenLastInDirective(r) + "\n "; + }; + ChangeDetectorJITGenerator.prototype._genDirectiveLifecycle = function(r) { + if (r.name === "DoCheck") { + return this._genOnCheck(r); + } else if (r.name === "OnInit") { + return this._genOnInit(r); + } else if (r.name === "OnChanges") { + return this._genOnChange(r); + } else { + throw new exceptions_1.BaseException("Unknown lifecycle event '" + r.name + "'"); + } + }; + ChangeDetectorJITGenerator.prototype._genPipeCheck = function(r) { + var _this = this; + var context = this._names.getLocalName(r.contextIndex); + var argString = r.args.map(function(arg) { + return _this._names.getLocalName(arg); + }).join(", "); + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var pipe = this._names.getPipeName(r.selfIndex); + var pipeName = r.name; + var init = "\n if (" + pipe + " === " + this.changeDetectionUtilVarName + ".uninitialized) {\n " + pipe + " = " + this._names.getPipesAccessorName() + ".get('" + pipeName + "');\n }\n "; + var read = newValue + " = " + pipe + ".pipe.transform(" + context + ", [" + argString + "]);"; + var contexOrArgCheck = r.args.map(function(a) { + return _this._names.getChangeName(a); + }); + contexOrArgCheck.push(this._names.getChangeName(r.contextIndex)); + var condition = "!" + pipe + ".pure || (" + contexOrArgCheck.join(" || ") + ")"; + var check = "\n if (" + oldValue + " !== " + newValue + ") {\n " + newValue + " = " + this.changeDetectionUtilVarName + ".unwrapValue(" + newValue + ")\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isUsedByOtherRecord()) { + return init + " if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return init + " if (" + condition + ") { " + genCode + " }"; + } + }; + ChangeDetectorJITGenerator.prototype._genReferenceCheck = function(r) { + var _this = this; + var oldValue = this._names.getFieldName(r.selfIndex); + var newValue = this._names.getLocalName(r.selfIndex); + var read = "\n " + this._logic.genPropertyBindingEvalValue(r) + "\n "; + var check = "\n if (" + newValue + " !== " + oldValue + ") {\n " + this._genChangeMarker(r) + "\n " + this._genUpdateDirectiveOrElement(r) + "\n " + this._genAddToChanges(r) + "\n " + oldValue + " = " + newValue + ";\n }\n "; + var genCode = r.shouldBeChecked() ? "" + read + check : read; + if (r.isPureFunction()) { + var condition = r.args.map(function(a) { + return _this._names.getChangeName(a); + }).join(" || "); + if (r.isUsedByOtherRecord()) { + return "if (" + condition + ") { " + genCode + " } else { " + newValue + " = " + oldValue + "; }"; + } else { + return "if (" + condition + ") { " + genCode + " }"; + } + } else { + return genCode; + } + }; + ChangeDetectorJITGenerator.prototype._genChangeMarker = function(r) { + return r.argumentToPureFunction ? this._names.getChangeName(r.selfIndex) + " = true" : ""; + }; + ChangeDetectorJITGenerator.prototype._genUpdateDirectiveOrElement = function(r) { + if (!r.lastInBinding) + return ""; + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + var notifyDebug = this.genConfig.logBindingUpdate ? "this.logBindingUpdate(" + newValue + ");" : ""; + var br = r.bindingRecord; + if (br.target.isDirective()) { + var directiveProperty = this._names.getDirectiveName(br.directiveRecord.directiveIndex) + "." + br.target.name; + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n " + directiveProperty + " = " + newValue + ";\n " + notifyDebug + "\n " + IS_CHANGED_LOCAL + " = true;\n "; + } else { + return "\n " + this._genThrowOnChangeCheck(oldValue, newValue) + "\n this.notifyDispatcher(" + newValue + ");\n " + notifyDebug + "\n "; + } + }; + ChangeDetectorJITGenerator.prototype._genThrowOnChangeCheck = function(oldValue, newValue) { + if (this.genConfig.genCheckNoChanges) { + return "\n if(throwOnChange) {\n this.throwOnChangeError(" + oldValue + ", " + newValue + ");\n }\n "; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genCheckNoChanges = function() { + if (this.genConfig.genCheckNoChanges) { + return this.typeName + ".prototype.checkNoChanges = function() { this.runDetectChanges(true); }"; + } else { + return ''; + } + }; + ChangeDetectorJITGenerator.prototype._genAddToChanges = function(r) { + var newValue = this._names.getLocalName(r.selfIndex); + var oldValue = this._names.getFieldName(r.selfIndex); + if (!r.bindingRecord.callOnChanges()) + return ""; + return CHANGES_LOCAL + " = this.addChange(" + CHANGES_LOCAL + ", " + oldValue + ", " + newValue + ");"; + }; + ChangeDetectorJITGenerator.prototype._maybeFirstInBinding = function(r) { + var prev = change_detection_util_1.ChangeDetectionUtil.protoByIndex(this.records, r.selfIndex - 1); + var firstInBindng = lang_1.isBlank(prev) || prev.bindingRecord !== r.bindingRecord; + return firstInBindng && !r.bindingRecord.isDirectiveLifecycle() ? this._names.getPropertyBindingIndex() + " = " + r.propertyBindingIndex + ";" : ''; + }; + ChangeDetectorJITGenerator.prototype._maybeGenLastInDirective = function(r) { + if (!r.lastInDirective) + return ""; + return "\n " + CHANGES_LOCAL + " = null;\n " + this._genNotifyOnPushDetectors(r) + "\n " + IS_CHANGED_LOCAL + " = false;\n "; + }; + ChangeDetectorJITGenerator.prototype._genOnCheck = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange) " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".doCheck();"; + }; + ChangeDetectorJITGenerator.prototype._genOnInit = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && !" + this._names.getAlreadyCheckedName() + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onInit();"; + }; + ChangeDetectorJITGenerator.prototype._genOnChange = function(r) { + var br = r.bindingRecord; + return "if (!throwOnChange && " + CHANGES_LOCAL + ") " + this._names.getDirectiveName(br.directiveRecord.directiveIndex) + ".onChanges(" + CHANGES_LOCAL + ");"; + }; + ChangeDetectorJITGenerator.prototype._genNotifyOnPushDetectors = function(r) { + var br = r.bindingRecord; + if (!r.lastInDirective || br.isDefaultChangeDetection()) + return ""; + var retVal = "\n if(" + IS_CHANGED_LOCAL + ") {\n " + this._names.getDetectorName(br.directiveRecord.directiveIndex) + ".markAsCheckOnce();\n }\n "; + return retVal; + }; + return ChangeDetectorJITGenerator; + })(); + exports.ChangeDetectorJITGenerator = ChangeDetectorJITGenerator; + global.define = __define; + return module.exports; +}); + +/** + @license + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015 Netflix, Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +System.register("@reactivex/rxjs/dist/cjs/Subject", ["@reactivex/rxjs/dist/cjs/Observable", "@reactivex/rxjs/dist/cjs/Subscriber", "@reactivex/rxjs/dist/cjs/Subscription", "@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + 'use strict'; + exports.__esModule = true; + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : {'default': obj}; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError('Cannot call a class as a function'); + } + } + function _inherits(subClass, superClass) { + if (typeof superClass !== 'function' && superClass !== null) { + throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); + } + subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + }}); + if (superClass) + Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + var _Observable2 = require("@reactivex/rxjs/dist/cjs/Observable"); + var _Observable3 = _interopRequireDefault(_Observable2); + var _Subscriber = require("@reactivex/rxjs/dist/cjs/Subscriber"); + var _Subscriber2 = _interopRequireDefault(_Subscriber); + var _Subscription = require("@reactivex/rxjs/dist/cjs/Subscription"); + var _Subscription2 = _interopRequireDefault(_Subscription); + var _subjectsSubjectSubscription = require("@reactivex/rxjs/dist/cjs/subjects/SubjectSubscription"); + var _subjectsSubjectSubscription2 = _interopRequireDefault(_subjectsSubjectSubscription); + var subscriptionAdd = _Subscription2['default'].prototype.add; + var subscriptionRemove = _Subscription2['default'].prototype.remove; + var subscriptionUnsubscribe = _Subscription2['default'].prototype.unsubscribe; + var subscriberNext = _Subscriber2['default'].prototype.next; + var subscriberError = _Subscriber2['default'].prototype.error; + var subscriberComplete = _Subscriber2['default'].prototype.complete; + var _subscriberNext = _Subscriber2['default'].prototype._next; + var _subscriberError = _Subscriber2['default'].prototype._error; + var _subscriberComplete = _Subscriber2['default'].prototype._complete; + var _observableSubscribe = _Observable3['default'].prototype._subscribe; + var Subject = (function(_Observable) { + _inherits(Subject, _Observable); + function Subject() { + _classCallCheck(this, Subject); + for (var _len = arguments.length, + args = Array(_len), + _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + _Observable.call.apply(_Observable, [this].concat(args)); + this.observers = []; + this.isUnsubscribed = false; + this.dispatching = false; + this.errorSignal = false; + this.completeSignal = false; + } + Subject.create = function create(source, destination) { + return new BidirectionalSubject(source, destination); + }; + Subject.prototype.lift = function lift(operator) { + var subject = new BidirectionalSubject(this, this.destination || this); + subject.operator = operator; + return subject; + }; + Subject.prototype._subscribe = function _subscribe(subscriber) { + if (subscriber.isUnsubscribed) { + return ; + } else if (this.errorSignal) { + subscriber.error(this.errorInstance); + return ; + } else if (this.completeSignal) { + subscriber.complete(); + return ; + } else if (this.isUnsubscribed) { + throw new Error("Cannot subscribe to a disposed Subject."); + } + this.observers.push(subscriber); + return new _subjectsSubjectSubscription2['default'](this, subscriber); + }; + Subject.prototype.add = function add(subscription) { + subscriptionAdd.call(this, subscription); + }; + Subject.prototype.remove = function remove(subscription) { + subscriptionRemove.call(this, subscription); + }; + Subject.prototype.unsubscribe = function unsubscribe() { + this.observers = void 0; + subscriptionUnsubscribe.call(this); + }; + Subject.prototype.next = function next(value) { + if (this.isUnsubscribed) { + return ; + } + this.dispatching = true; + this._next(value); + this.dispatching = false; + if (this.errorSignal) { + this.error(this.errorInstance); + } else if (this.completeSignal) { + this.complete(); + } + }; + Subject.prototype.error = function error(_error) { + if (this.isUnsubscribed || this.completeSignal) { + return ; + } + this.errorSignal = true; + this.errorInstance = _error; + if (this.dispatching) { + return ; + } + this._error(_error); + this.unsubscribe(); + }; + Subject.prototype.complete = function complete() { + if (this.isUnsubscribed || this.errorSignal) { + return ; + } + this.completeSignal = true; + if (this.dispatching) { + return ; + } + this._complete(); + this.unsubscribe(); + }; + Subject.prototype._next = function _next(value) { + var index = -1; + var observers = this.observers.slice(0); + var len = observers.length; + while (++index < len) { + observers[index].next(value); + } + }; + Subject.prototype._error = function _error(error) { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].error(error); + } + this.isUnsubscribed = false; + }; + Subject.prototype._complete = function _complete() { + var index = -1; + var observers = this.observers; + var len = observers.length; + this.observers = void 0; + this.isUnsubscribed = true; + while (++index < len) { + observers[index].complete(); + } + this.isUnsubscribed = false; + }; + return Subject; + })(_Observable3['default']); + exports['default'] = Subject; + var BidirectionalSubject = (function(_Subject) { + _inherits(BidirectionalSubject, _Subject); + function BidirectionalSubject(source, destination) { + _classCallCheck(this, BidirectionalSubject); + _Subject.call(this); + this.source = source; + this.destination = destination; + } + BidirectionalSubject.prototype._subscribe = function _subscribe(subscriber) { + return _observableSubscribe.call(this, subscriber); + }; + BidirectionalSubject.prototype.next = function next(x) { + subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype.error = function error(e) { + subscriberError.call(this, e); + }; + BidirectionalSubject.prototype.complete = function complete() { + subscriberComplete.call(this); + }; + BidirectionalSubject.prototype._next = function _next(x) { + _subscriberNext.call(this, x); + }; + BidirectionalSubject.prototype._error = function _error(e) { + _subscriberError.call(this, e); + }; + BidirectionalSubject.prototype._complete = function _complete() { + _subscriberComplete.call(this); + }; + return BidirectionalSubject; + })(Subject); + module.exports = exports['default']; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/view_manager", ["angular2/src/core/di", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/compiler/view_ref", "angular2/src/core/render/api", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_listener", "angular2/src/core/profile/profile"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var api_1 = require("angular2/src/core/render/api"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var profile_1 = require("angular2/src/core/profile/profile"); + var AppViewManager = (function() { + function AppViewManager(_viewPool, _viewListener, _utils, _renderer) { + this._viewPool = _viewPool; + this._viewListener = _viewListener; + this._utils = _utils; + this._renderer = _renderer; + this._createRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#createRootHostView()'); + this._destroyRootHostViewScope = profile_1.wtfCreateScope('AppViewManager#destroyRootHostView()'); + this._createEmbeddedViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createEmbeddedViewInContainer()'); + this._createHostViewInContainerScope = profile_1.wtfCreateScope('AppViewManager#createHostViewInContainer()'); + this._destroyViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#destroyViewInContainer()'); + this._attachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#attachViewInContainer()'); + this._detachViewInContainerScope = profile_1.wtfCreateScope('AppViewMananger#detachViewInContainer()'); + } + AppViewManager.prototype.getViewContainer = function(location) { + var hostView = view_ref_1.internalView(location.parentView); + return hostView.elementInjectors[location.boundElementIndex].getViewContainerRef(); + }; + AppViewManager.prototype.getHostElement = function(hostViewRef) { + var hostView = view_ref_1.internalView(hostViewRef); + if (hostView.proto.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This operation is only allowed on host views'); + } + return hostView.elementRefs[hostView.elementOffset]; + }; + AppViewManager.prototype.getNamedElementInComponentView = function(hostLocation, variableName) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + var componentView = hostView.getNestedView(boundElementIndex); + if (lang_1.isBlank(componentView)) { + throw new exceptions_1.BaseException("There is no component directive at element " + boundElementIndex); + } + var binderIdx = componentView.proto.variableLocations.get(variableName); + if (lang_1.isBlank(binderIdx)) { + throw new exceptions_1.BaseException("Could not find variable " + variableName); + } + return componentView.elementRefs[componentView.elementOffset + binderIdx]; + }; + AppViewManager.prototype.getComponent = function(hostLocation) { + var hostView = view_ref_1.internalView(hostLocation.parentView); + var boundElementIndex = hostLocation.boundElementIndex; + return this._utils.getComponentInstance(hostView, boundElementIndex); + }; + AppViewManager.prototype.createRootHostView = function(hostProtoViewRef, overrideSelector, injector) { + var s = this._createRootHostViewScope(); + var hostProtoView = view_ref_1.internalProtoView(hostProtoViewRef); + var hostElementSelector = overrideSelector; + if (lang_1.isBlank(hostElementSelector)) { + hostElementSelector = hostProtoView.elementBinders[0].componentDirective.metadata.selector; + } + var renderViewWithFragments = this._renderer.createRootHostView(hostProtoView.mergeMapping.renderProtoViewRef, hostProtoView.mergeMapping.renderFragmentCount, hostElementSelector); + var hostView = this._createMainView(hostProtoView, renderViewWithFragments); + this._renderer.hydrateView(hostView.render); + this._utils.hydrateRootHostView(hostView, injector); + return profile_1.wtfLeave(s, hostView.ref); + }; + AppViewManager.prototype.destroyRootHostView = function(hostViewRef) { + var s = this._destroyRootHostViewScope(); + var hostView = view_ref_1.internalView(hostViewRef); + this._renderer.detachFragment(hostView.renderFragment); + this._renderer.dehydrateView(hostView.render); + this._viewDehydrateRecurse(hostView); + this._viewListener.viewDestroyed(hostView); + this._renderer.destroyView(hostView.render); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.createEmbeddedViewInContainer = function(viewContainerLocation, atIndex, templateRef) { + var s = this._createEmbeddedViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(templateRef.protoViewRef); + if (protoView.type !== api_1.ViewType.EMBEDDED) { + throw new exceptions_1.BaseException('This method can only be called with embedded ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, templateRef.elementRef, null)); + }; + AppViewManager.prototype.createHostViewInContainer = function(viewContainerLocation, atIndex, protoViewRef, imperativelyCreatedInjector) { + var s = this._createHostViewInContainerScope(); + var protoView = view_ref_1.internalProtoView(protoViewRef); + if (protoView.type !== api_1.ViewType.HOST) { + throw new exceptions_1.BaseException('This method can only be called with host ProtoViews!'); + } + return profile_1.wtfLeave(s, this._createViewInContainer(viewContainerLocation, atIndex, protoView, viewContainerLocation, imperativelyCreatedInjector)); + }; + AppViewManager.prototype._createViewInContainer = function(viewContainerLocation, atIndex, protoView, context, imperativelyCreatedInjector) { + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var contextView = view_ref_1.internalView(context.parentView); + var contextBoundElementIndex = context.boundElementIndex; + var embeddedFragmentView = contextView.getNestedView(contextBoundElementIndex); + var view; + if (protoView.type === api_1.ViewType.EMBEDDED && lang_1.isPresent(embeddedFragmentView) && !embeddedFragmentView.hydrated()) { + view = embeddedFragmentView; + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + } else { + view = this._createPooledView(protoView); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + this._renderer.hydrateView(view.render); + } + this._utils.attachViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, view); + this._utils.hydrateViewInContainer(parentView, boundElementIndex, contextView, contextBoundElementIndex, atIndex, imperativelyCreatedInjector); + return view.ref; + }; + AppViewManager.prototype._attachRenderView = function(parentView, boundElementIndex, atIndex, view) { + var elementRef = parentView.elementRefs[boundElementIndex]; + if (atIndex === 0) { + this._renderer.attachFragmentAfterElement(elementRef, view.renderFragment); + } else { + var prevView = parentView.viewContainers[boundElementIndex].views[atIndex - 1]; + this._renderer.attachFragmentAfterFragment(prevView.renderFragment, view.renderFragment); + } + }; + AppViewManager.prototype.destroyViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._destroyViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._destroyViewInContainer(parentView, boundElementIndex, atIndex); + profile_1.wtfLeave(s); + }; + AppViewManager.prototype.attachViewInContainer = function(viewContainerLocation, atIndex, viewRef) { + var s = this._attachViewInContainerScope(); + var view = view_ref_1.internalView(viewRef); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + this._utils.attachViewInContainer(parentView, boundElementIndex, null, null, atIndex, view); + this._attachRenderView(parentView, boundElementIndex, atIndex, view); + return profile_1.wtfLeave(s, viewRef); + }; + AppViewManager.prototype.detachViewInContainer = function(viewContainerLocation, atIndex) { + var s = this._detachViewInContainerScope(); + var parentView = view_ref_1.internalView(viewContainerLocation.parentView); + var boundElementIndex = viewContainerLocation.boundElementIndex; + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + this._renderer.detachFragment(view.renderFragment); + return profile_1.wtfLeave(s, view.ref); + }; + AppViewManager.prototype._createMainView = function(protoView, renderViewWithFragments) { + var mergedParentView = this._utils.createView(protoView, renderViewWithFragments, this, this._renderer); + this._renderer.setEventDispatcher(mergedParentView.render, mergedParentView); + this._viewListener.viewCreated(mergedParentView); + return mergedParentView; + }; + AppViewManager.prototype._createPooledView = function(protoView) { + var view = this._viewPool.getView(protoView); + if (lang_1.isBlank(view)) { + view = this._createMainView(protoView, this._renderer.createView(protoView.mergeMapping.renderProtoViewRef, protoView.mergeMapping.renderFragmentCount)); + } + return view; + }; + AppViewManager.prototype._destroyPooledView = function(view) { + var wasReturned = this._viewPool.returnView(view); + if (!wasReturned) { + this._viewListener.viewDestroyed(view); + this._renderer.destroyView(view.render); + } + }; + AppViewManager.prototype._destroyViewInContainer = function(parentView, boundElementIndex, atIndex) { + var viewContainer = parentView.viewContainers[boundElementIndex]; + var view = viewContainer.views[atIndex]; + this._viewDehydrateRecurse(view); + this._utils.detachViewInContainer(parentView, boundElementIndex, atIndex); + if (view.viewOffset > 0) { + this._renderer.detachFragment(view.renderFragment); + } else { + this._renderer.dehydrateView(view.render); + this._renderer.detachFragment(view.renderFragment); + this._destroyPooledView(view); + } + }; + AppViewManager.prototype._viewDehydrateRecurse = function(view) { + if (view.hydrated()) { + this._utils.dehydrateView(view); + } + var viewContainers = view.viewContainers; + var startViewOffset = view.viewOffset; + var endViewOffset = view.viewOffset + view.mainMergeMapping.nestedViewCountByViewIndex[view.viewOffset]; + var elementOffset = view.elementOffset; + for (var viewIdx = startViewOffset; viewIdx <= endViewOffset; viewIdx++) { + var currView = view.views[viewIdx]; + for (var binderIdx = 0; binderIdx < currView.proto.elementBinders.length; binderIdx++, elementOffset++) { + var vc = viewContainers[elementOffset]; + if (lang_1.isPresent(vc)) { + for (var j = vc.views.length - 1; j >= 0; j--) { + this._destroyViewInContainer(currView, elementOffset, j); + } + } + } + } + }; + AppViewManager = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [view_pool_1.AppViewPool, view_listener_1.AppViewListener, view_manager_utils_1.AppViewManagerUtils, api_1.Renderer])], AppViewManager); + return AppViewManager; + })(); + exports.AppViewManager = AppViewManager; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/template_compiler", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/collection", "angular2/src/core/facade/async", "angular2/src/core/compiler/template_commands", "angular2/src/compiler/directive_metadata", "angular2/src/core/di", "angular2/src/compiler/source_module", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/command_compiler", "angular2/src/compiler/util"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var collection_1 = require("angular2/src/core/facade/collection"); + var async_1 = require("angular2/src/core/facade/async"); + var template_commands_1 = require("angular2/src/core/compiler/template_commands"); + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + var di_1 = require("angular2/src/core/di"); + var source_module_1 = require("angular2/src/compiler/source_module"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var command_compiler_2 = require("angular2/src/compiler/command_compiler"); + var util_1 = require("angular2/src/compiler/util"); + var TemplateCompiler = (function() { + function TemplateCompiler(_runtimeMetadataResolver, _templateNormalizer, _templateParser, _styleCompiler, _commandCompiler, _cdCompiler) { + this._runtimeMetadataResolver = _runtimeMetadataResolver; + this._templateNormalizer = _templateNormalizer; + this._templateParser = _templateParser; + this._styleCompiler = _styleCompiler; + this._commandCompiler = _commandCompiler; + this._cdCompiler = _cdCompiler; + this._compiledTemplateCache = new Map(); + this._compiledTemplateDone = new Map(); + } + TemplateCompiler.prototype.normalizeDirectiveMetadata = function(directive) { + var normalizedTemplatePromise; + if (directive.isComponent) { + normalizedTemplatePromise = this._templateNormalizer.normalizeTemplate(directive.type, directive.template); + } else { + normalizedTemplatePromise = async_1.PromiseWrapper.resolve(null); + } + return normalizedTemplatePromise.then(function(normalizedTemplate) { + return new directive_metadata_1.CompileDirectiveMetadata({ + type: directive.type, + isComponent: directive.isComponent, + dynamicLoadable: directive.dynamicLoadable, + selector: directive.selector, + exportAs: directive.exportAs, + changeDetection: directive.changeDetection, + properties: directive.properties, + events: directive.events, + hostListeners: directive.hostListeners, + hostProperties: directive.hostProperties, + hostAttributes: directive.hostAttributes, + lifecycleHooks: directive.lifecycleHooks, + template: normalizedTemplate + }); + }); + }; + TemplateCompiler.prototype.compileHostComponentRuntime = function(type) { + var compMeta = this._runtimeMetadataResolver.getMetadata(type); + assertComponent(compMeta); + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + this._compileComponentRuntime(hostMeta, [compMeta], new Set()); + return this._compiledTemplateDone.get(hostMeta.type.id); + }; + TemplateCompiler.prototype.clearCache = function() { + this._styleCompiler.clearCache(); + this._compiledTemplateCache.clear(); + this._compiledTemplateDone.clear(); + }; + TemplateCompiler.prototype._compileComponentRuntime = function(compMeta, viewDirectives, compilingComponentIds) { + var _this = this; + var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.id); + var done = this._compiledTemplateDone.get(compMeta.type.id); + if (lang_1.isBlank(compiledTemplate)) { + var styles; + var changeDetectorFactory; + var commands; + compiledTemplate = new template_commands_1.CompiledTemplate(compMeta.type.id, function() { + return [changeDetectorFactory, commands, styles]; + }); + this._compiledTemplateCache.set(compMeta.type.id, compiledTemplate); + compilingComponentIds.add(compMeta.type.id); + done = async_1.PromiseWrapper.all([this._styleCompiler.compileComponentRuntime(compMeta.type, compMeta.template)].concat(viewDirectives.map(function(dirMeta) { + return _this.normalizeDirectiveMetadata(dirMeta); + }))).then(function(stylesAndNormalizedViewDirMetas) { + var childPromises = []; + var normalizedViewDirMetas = stylesAndNormalizedViewDirMetas.slice(1); + var parsedTemplate = _this._templateParser.parse(compMeta.template.template, normalizedViewDirMetas, compMeta.type.name); + var changeDetectorFactories = _this._cdCompiler.compileComponentRuntime(compMeta.type, compMeta.changeDetection, parsedTemplate); + changeDetectorFactory = changeDetectorFactories[0]; + styles = stylesAndNormalizedViewDirMetas[0]; + commands = _this._compileCommandsRuntime(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises); + return async_1.PromiseWrapper.all(childPromises); + }).then(function(_) { + collection_1.SetWrapper.delete(compilingComponentIds, compMeta.type.id); + return compiledTemplate; + }); + this._compiledTemplateDone.set(compMeta.type.id, done); + } + return compiledTemplate; + }; + TemplateCompiler.prototype._compileCommandsRuntime = function(compMeta, parsedTemplate, changeDetectorFactories, compilingComponentIds, childPromises) { + var _this = this; + return this._commandCompiler.compileComponentRuntime(compMeta, parsedTemplate, changeDetectorFactories, function(childComponentDir) { + var childViewDirectives = _this._runtimeMetadataResolver.getViewDirectivesMetadata(childComponentDir.type.runtime); + var childIsRecursive = collection_1.SetWrapper.has(compilingComponentIds, childComponentDir.type.id); + var childTemplate = _this._compileComponentRuntime(childComponentDir, childViewDirectives, compilingComponentIds); + if (!childIsRecursive) { + childPromises.push(_this._compiledTemplateDone.get(childComponentDir.type.id)); + } + return childTemplate; + }); + }; + TemplateCompiler.prototype.compileTemplatesCodeGen = function(moduleId, components) { + var _this = this; + var declarations = []; + var templateArguments = []; + var componentMetas = []; + components.forEach(function(componentWithDirs) { + var compMeta = componentWithDirs.component; + assertComponent(compMeta); + componentMetas.push(compMeta); + _this._processTemplateCodeGen(compMeta, componentWithDirs.directives, declarations, templateArguments); + if (compMeta.dynamicLoadable) { + var hostMeta = directive_metadata_1.createHostComponentMeta(compMeta.type, compMeta.selector); + componentMetas.push(hostMeta); + _this._processTemplateCodeGen(hostMeta, [compMeta], declarations, templateArguments); + } + }); + collection_1.ListWrapper.forEachWithIndex(componentMetas, function(compMeta, index) { + var templateDataFn = util_1.codeGenValueFn([], "[" + templateArguments[index].join(',') + "]"); + declarations.push(util_1.codeGenExportVariable(templateVariableName(compMeta.type)) + "new " + command_compiler_2.TEMPLATE_COMMANDS_MODULE_REF + "CompiledTemplate(" + compMeta.type.id + "," + templateDataFn + ");"); + }); + return new source_module_1.SourceModule("" + templateModuleName(moduleId), declarations.join('\n')); + }; + TemplateCompiler.prototype.compileStylesheetCodeGen = function(moduleId, cssText) { + return this._styleCompiler.compileStylesheetCodeGen(moduleId, cssText); + }; + TemplateCompiler.prototype._processTemplateCodeGen = function(compMeta, directives, targetDeclarations, targetTemplateArguments) { + var styleExpr = this._styleCompiler.compileComponentCodeGen(compMeta.type, compMeta.template); + var parsedTemplate = this._templateParser.parse(compMeta.template.template, directives, compMeta.type.name); + var changeDetectorsExprs = this._cdCompiler.compileComponentCodeGen(compMeta.type, compMeta.changeDetection, parsedTemplate); + var commandsExpr = this._commandCompiler.compileComponentCodeGen(compMeta, parsedTemplate, changeDetectorsExprs.expressions, codeGenComponentTemplateFactory); + addAll(styleExpr.declarations, targetDeclarations); + addAll(changeDetectorsExprs.declarations, targetDeclarations); + addAll(commandsExpr.declarations, targetDeclarations); + targetTemplateArguments.push([changeDetectorsExprs.expressions[0], commandsExpr.expression, styleExpr.expression]); + }; + TemplateCompiler = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [runtime_metadata_1.RuntimeMetadataResolver, template_normalizer_1.TemplateNormalizer, template_parser_1.TemplateParser, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler])], TemplateCompiler); + return TemplateCompiler; + })(); + exports.TemplateCompiler = TemplateCompiler; + var NormalizedComponentWithViewDirectives = (function() { + function NormalizedComponentWithViewDirectives(component, directives) { + this.component = component; + this.directives = directives; + } + return NormalizedComponentWithViewDirectives; + })(); + exports.NormalizedComponentWithViewDirectives = NormalizedComponentWithViewDirectives; + function assertComponent(meta) { + if (!meta.isComponent) { + throw new exceptions_1.BaseException("Could not compile '" + meta.type.name + "' because it is not a component."); + } + } + function templateVariableName(type) { + return type.name + "Template"; + } + function templateModuleName(moduleId) { + return moduleId + ".template"; + } + function addAll(source, target) { + for (var i = 0; i < source.length; i++) { + target.push(source[i]); + } + } + function codeGenComponentTemplateFactory(nestedCompType) { + return "" + source_module_1.moduleRef(templateModuleName(nestedCompType.type.moduleId)) + templateVariableName(nestedCompType.type); + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/facade/async", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/api", "angular2/src/core/render/dom/compiler/compile_pipeline", "angular2/src/core/facade/exceptions", "angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/compiler/compile_step_factory", "angular2/src/core/render/dom/schema/element_schema_registry", "angular2/src/core/change_detection/change_detection", "angular2/src/core/render/dom/view/proto_view_merger", "angular2/src/core/render/dom/compiler/selector", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/render/dom/template_cloner"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var async_1 = require("angular2/src/core/facade/async"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var api_1 = require("angular2/src/core/render/api"); + var compile_pipeline_1 = require("angular2/src/core/render/dom/compiler/compile_pipeline"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var view_loader_1 = require("angular2/src/core/render/dom/compiler/view_loader"); + var compile_step_factory_1 = require("angular2/src/core/render/dom/compiler/compile_step_factory"); + var element_schema_registry_1 = require("angular2/src/core/render/dom/schema/element_schema_registry"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var pvm = require("angular2/src/core/render/dom/view/proto_view_merger"); + var selector_1 = require("angular2/src/core/render/dom/compiler/selector"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var DomCompiler = (function(_super) { + __extends(DomCompiler, _super); + function DomCompiler(_schemaRegistry, _templateCloner, _stepFactory, _viewLoader, _sharedStylesHost) { + _super.call(this); + this._schemaRegistry = _schemaRegistry; + this._templateCloner = _templateCloner; + this._stepFactory = _stepFactory; + this._viewLoader = _viewLoader; + this._sharedStylesHost = _sharedStylesHost; + } + DomCompiler.prototype.compile = function(view) { + var _this = this; + var tplPromise = this._viewLoader.load(view); + return async_1.PromiseWrapper.then(tplPromise, function(tplAndStyles) { + return _this._compileView(view, tplAndStyles, api_1.ViewType.COMPONENT); + }, function(e) { + throw new exceptions_1.BaseException("Failed to load the template for \"" + view.componentId + "\" : " + e); + return null; + }); + }; + DomCompiler.prototype.compileHost = function(directiveMetadata) { + var hostViewDef = new api_1.ViewDefinition({ + componentId: directiveMetadata.id, + templateAbsUrl: null, + template: null, + styles: null, + styleAbsUrls: null, + directives: [directiveMetadata], + encapsulation: api_1.ViewEncapsulation.None + }); + var selector = selector_1.CssSelector.parse(directiveMetadata.selector)[0]; + var hostTemplate = selector.getMatchingElementTemplate(); + var templateAndStyles = new view_loader_1.TemplateAndStyles(hostTemplate, []); + return this._compileView(hostViewDef, templateAndStyles, api_1.ViewType.HOST); + }; + DomCompiler.prototype.mergeProtoViewsRecursively = function(protoViewRefs) { + return async_1.PromiseWrapper.resolve(pvm.mergeProtoViewsRecursively(this._templateCloner, protoViewRefs)); + }; + DomCompiler.prototype._compileView = function(viewDef, templateAndStyles, protoViewType) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated && templateAndStyles.styles.length === 0) { + viewDef = this._normalizeViewEncapsulationIfThereAreNoStyles(viewDef); + } + var pipeline = new compile_pipeline_1.CompilePipeline(this._stepFactory.createSteps(viewDef)); + var compiledStyles = pipeline.processStyles(templateAndStyles.styles); + var compileElements = pipeline.processElements(this._createTemplateElm(templateAndStyles.template), protoViewType, viewDef); + if (viewDef.encapsulation === api_1.ViewEncapsulation.Native) { + util_1.prependAll(dom_adapter_1.DOM.content(compileElements[0].element), compiledStyles.map(function(style) { + return dom_adapter_1.DOM.createStyleElement(style); + })); + } else { + this._sharedStylesHost.addStyles(compiledStyles); + } + return async_1.PromiseWrapper.resolve(compileElements[0].inheritedProtoView.build(this._schemaRegistry, this._templateCloner)); + }; + DomCompiler.prototype._createTemplateElm = function(template) { + var templateElm = dom_adapter_1.DOM.createTemplate(template); + var scriptTags = dom_adapter_1.DOM.querySelectorAll(dom_adapter_1.DOM.templateAwareRoot(templateElm), 'script'); + for (var i = 0; i < scriptTags.length; i++) { + dom_adapter_1.DOM.remove(scriptTags[i]); + } + return templateElm; + }; + DomCompiler.prototype._normalizeViewEncapsulationIfThereAreNoStyles = function(viewDef) { + if (viewDef.encapsulation === api_1.ViewEncapsulation.Emulated) { + return new api_1.ViewDefinition({ + componentId: viewDef.componentId, + templateAbsUrl: viewDef.templateAbsUrl, + template: viewDef.template, + styleAbsUrls: viewDef.styleAbsUrls, + styles: viewDef.styles, + directives: viewDef.directives, + encapsulation: api_1.ViewEncapsulation.None + }); + } else { + return viewDef; + } + }; + return DomCompiler; + })(api_1.RenderCompiler); + exports.DomCompiler = DomCompiler; + var DefaultDomCompiler = (function(_super) { + __extends(DefaultDomCompiler, _super); + function DefaultDomCompiler(schemaRegistry, templateCloner, parser, viewLoader, sharedStylesHost, appId) { + _super.call(this, schemaRegistry, templateCloner, new compile_step_factory_1.DefaultStepFactory(parser, appId), viewLoader, sharedStylesHost); + } + DefaultDomCompiler = __decorate([di_1.Injectable(), __param(5, di_1.Inject(dom_tokens_1.APP_ID)), __metadata('design:paramtypes', [element_schema_registry_1.ElementSchemaRegistry, template_cloner_1.TemplateCloner, change_detection_1.Parser, view_loader_1.ViewLoader, shared_styles_host_1.SharedStylesHost, Object])], DefaultDomCompiler); + return DefaultDomCompiler; + })(DomCompiler); + exports.DefaultDomCompiler = DefaultDomCompiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/animate/animation_builder", ["angular2/src/core/di", "angular2/src/animate/css_animation_builder", "angular2/src/animate/browser_details"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 css_animation_builder_1 = require("angular2/src/animate/css_animation_builder"); + var browser_details_1 = require("angular2/src/animate/browser_details"); + var AnimationBuilder = (function() { + function AnimationBuilder(browserDetails) { + this.browserDetails = browserDetails; + } + AnimationBuilder.prototype.css = function() { + return new css_animation_builder_1.CssAnimationBuilder(this.browserDetails); + }; + AnimationBuilder = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [browser_details_1.BrowserDetails])], AnimationBuilder); + return AnimationBuilder; + })(); + exports.AnimationBuilder = AnimationBuilder; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/xhr_impl", ["angular2/src/core/di", "angular2/src/core/render/xhr", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/web_workers/shared/messaging_api"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 xhr_1 = require("angular2/src/core/render/xhr"); + var client_message_broker_1 = require("angular2/src/web_workers/shared/client_message_broker"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var WebWorkerXHRImpl = (function(_super) { + __extends(WebWorkerXHRImpl, _super); + function WebWorkerXHRImpl(messageBrokerFactory) { + _super.call(this); + this._messageBroker = messageBrokerFactory.createMessageBroker(messaging_api_1.XHR_CHANNEL); + } + WebWorkerXHRImpl.prototype.get = function(url) { + var fnArgs = [new client_message_broker_1.FnArg(url, null)]; + var args = new client_message_broker_1.UiArguments("get", fnArgs); + return this._messageBroker.runOnService(args, String); + }; + WebWorkerXHRImpl = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [client_message_broker_1.ClientMessageBrokerFactory])], WebWorkerXHRImpl); + return WebWorkerXHRImpl; + })(xhr_1.XHR); + exports.WebWorkerXHRImpl = WebWorkerXHRImpl; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/di", ["angular2/src/core/di/metadata", "angular2/src/core/di/decorators", "angular2/src/core/di/forward_ref", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/di/key", "angular2/src/core/di/exceptions", "angular2/src/core/di/opaque_token"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var metadata_1 = require("angular2/src/core/di/metadata"); + exports.InjectMetadata = metadata_1.InjectMetadata; + exports.OptionalMetadata = metadata_1.OptionalMetadata; + exports.InjectableMetadata = metadata_1.InjectableMetadata; + exports.SelfMetadata = metadata_1.SelfMetadata; + exports.HostMetadata = metadata_1.HostMetadata; + exports.SkipSelfMetadata = metadata_1.SkipSelfMetadata; + exports.DependencyMetadata = metadata_1.DependencyMetadata; + __export(require("angular2/src/core/di/decorators")); + var forward_ref_1 = require("angular2/src/core/di/forward_ref"); + exports.forwardRef = forward_ref_1.forwardRef; + exports.resolveForwardRef = forward_ref_1.resolveForwardRef; + var injector_1 = require("angular2/src/core/di/injector"); + exports.Injector = injector_1.Injector; + var binding_1 = require("angular2/src/core/di/binding"); + exports.Binding = binding_1.Binding; + exports.BindingBuilder = binding_1.BindingBuilder; + exports.ResolvedBinding = binding_1.ResolvedBinding; + exports.ResolvedFactory = binding_1.ResolvedFactory; + exports.Dependency = binding_1.Dependency; + exports.bind = binding_1.bind; + var key_1 = require("angular2/src/core/di/key"); + exports.Key = key_1.Key; + exports.TypeLiteral = key_1.TypeLiteral; + var exceptions_1 = require("angular2/src/core/di/exceptions"); + exports.NoBindingError = exceptions_1.NoBindingError; + exports.AbstractBindingError = exceptions_1.AbstractBindingError; + exports.CyclicDependencyError = exceptions_1.CyclicDependencyError; + exports.InstantiationError = exceptions_1.InstantiationError; + exports.InvalidBindingError = exceptions_1.InvalidBindingError; + exports.NoAnnotationError = exceptions_1.NoAnnotationError; + exports.OutOfBoundsError = exceptions_1.OutOfBoundsError; + var opaque_token_1 = require("angular2/src/core/di/opaque_token"); + exports.OpaqueToken = opaque_token_1.OpaqueToken; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection/jit_proto_change_detector", ["angular2/src/core/change_detection/change_detection_jit_generator"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_jit_generator_1 = require("angular2/src/core/change_detection/change_detection_jit_generator"); + var JitProtoChangeDetector = (function() { + function JitProtoChangeDetector(definition) { + this.definition = definition; + this._factory = this._createFactory(definition); + } + JitProtoChangeDetector.isSupported = function() { + return true; + }; + JitProtoChangeDetector.prototype.instantiate = function(dispatcher) { + return this._factory(dispatcher); + }; + JitProtoChangeDetector.prototype._createFactory = function(definition) { + return new change_detection_jit_generator_1.ChangeDetectorJITGenerator(definition, 'util', 'AbstractChangeDetector').generate(); + }; + return JitProtoChangeDetector; + })(); + exports.JitProtoChangeDetector = JitProtoChangeDetector; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/facade/async", ["angular2/src/core/facade/lang", "@reactivex/rxjs/dist/cjs/Subject"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var Subject = require("@reactivex/rxjs/dist/cjs/Subject"); + var PromiseWrapper = (function() { + function PromiseWrapper() {} + PromiseWrapper.resolve = function(obj) { + return Promise.resolve(obj); + }; + PromiseWrapper.reject = function(obj, _) { + return Promise.reject(obj); + }; + PromiseWrapper.catchError = function(promise, onError) { + return promise.catch(onError); + }; + PromiseWrapper.all = function(promises) { + if (promises.length == 0) + return Promise.resolve([]); + return Promise.all(promises); + }; + PromiseWrapper.then = function(promise, success, rejection) { + return promise.then(success, rejection); + }; + PromiseWrapper.wrap = function(computation) { + return new Promise(function(res, rej) { + try { + res(computation()); + } catch (e) { + rej(e); + } + }); + }; + PromiseWrapper.completer = function() { + var resolve; + var reject; + var p = new Promise(function(res, rej) { + resolve = res; + reject = rej; + }); + return { + promise: p, + resolve: resolve, + reject: reject + }; + }; + return PromiseWrapper; + })(); + exports.PromiseWrapper = PromiseWrapper; + var TimerWrapper = (function() { + function TimerWrapper() {} + TimerWrapper.setTimeout = function(fn, millis) { + return lang_1.global.setTimeout(fn, millis); + }; + TimerWrapper.clearTimeout = function(id) { + lang_1.global.clearTimeout(id); + }; + TimerWrapper.setInterval = function(fn, millis) { + return lang_1.global.setInterval(fn, millis); + }; + TimerWrapper.clearInterval = function(id) { + lang_1.global.clearInterval(id); + }; + return TimerWrapper; + })(); + exports.TimerWrapper = TimerWrapper; + var ObservableWrapper = (function() { + function ObservableWrapper() {} + ObservableWrapper.subscribe = function(emitter, onNext, onThrow, onReturn) { + if (onThrow === void 0) { + onThrow = null; + } + if (onReturn === void 0) { + onReturn = null; + } + return emitter.observer({ + next: onNext, + throw: onThrow, + return: onReturn + }); + }; + ObservableWrapper.isObservable = function(obs) { + return obs instanceof Observable; + }; + ObservableWrapper.dispose = function(subscription) { + subscription.unsubscribe(); + }; + ObservableWrapper.callNext = function(emitter, value) { + emitter.next(value); + }; + ObservableWrapper.callThrow = function(emitter, error) { + emitter.throw(error); + }; + ObservableWrapper.callReturn = function(emitter) { + emitter.return(null); + }; + return ObservableWrapper; + })(); + exports.ObservableWrapper = ObservableWrapper; + var Observable = (function() { + function Observable() {} + Observable.prototype.observer = function(generator) { + return null; + }; + return Observable; + })(); + exports.Observable = Observable; + var EventEmitter = (function(_super) { + __extends(EventEmitter, _super); + function EventEmitter() { + _super.apply(this, arguments); + this._subject = new Subject(); + } + EventEmitter.prototype.observer = function(generator) { + return this._subject.subscribe(function(value) { + setTimeout(function() { + return generator.next(value); + }); + }, function(error) { + return generator.throw ? generator.throw(error) : null; + }, function() { + return generator.return ? generator.return() : null; + }); + }; + EventEmitter.prototype.toRx = function() { + return this; + }; + EventEmitter.prototype.next = function(value) { + this._subject.next(value); + }; + EventEmitter.prototype.throw = function(error) { + this._subject.error(error); + }; + EventEmitter.prototype.return = function(value) { + this._subject.complete(); + }; + return EventEmitter; + })(Observable); + exports.EventEmitter = EventEmitter; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/element_injector", ["angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/di", "angular2/src/core/di/injector", "angular2/src/core/di/binding", "angular2/src/core/metadata/di", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_container_ref", "angular2/src/core/compiler/element_ref", "angular2/src/core/compiler/template_ref", "angular2/src/core/metadata/directives", "angular2/src/core/compiler/directive_lifecycle_reflector", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/query_list", "angular2/src/core/reflection/reflection", "angular2/src/core/render/api", "angular2/src/core/render/event_config", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/compiler/interfaces"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var di_1 = require("angular2/src/core/di"); + var injector_1 = require("angular2/src/core/di/injector"); + var binding_1 = require("angular2/src/core/di/binding"); + var di_2 = require("angular2/src/core/metadata/di"); + var avmModule = require("angular2/src/core/compiler/view_manager"); + var view_container_ref_1 = require("angular2/src/core/compiler/view_container_ref"); + var element_ref_1 = require("angular2/src/core/compiler/element_ref"); + var template_ref_1 = require("angular2/src/core/compiler/template_ref"); + var directives_1 = require("angular2/src/core/metadata/directives"); + var directive_lifecycle_reflector_1 = require("angular2/src/core/compiler/directive_lifecycle_reflector"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var query_list_1 = require("angular2/src/core/compiler/query_list"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var api_1 = require("angular2/src/core/render/api"); + var event_config_1 = require("angular2/src/core/render/event_config"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var interfaces_1 = require("angular2/src/core/compiler/interfaces"); + var _staticKeys; + var StaticKeys = (function() { + function StaticKeys() { + this.viewManagerId = di_1.Key.get(avmModule.AppViewManager).id; + this.templateRefId = di_1.Key.get(template_ref_1.TemplateRef).id; + this.viewContainerId = di_1.Key.get(view_container_ref_1.ViewContainerRef).id; + this.changeDetectorRefId = di_1.Key.get(change_detection_1.ChangeDetectorRef).id; + this.elementRefId = di_1.Key.get(element_ref_1.ElementRef).id; + } + StaticKeys.instance = function() { + if (lang_1.isBlank(_staticKeys)) + _staticKeys = new StaticKeys(); + return _staticKeys; + }; + return StaticKeys; + })(); + exports.StaticKeys = StaticKeys; + var TreeNode = (function() { + function TreeNode(parent) { + if (lang_1.isPresent(parent)) { + parent.addChild(this); + } else { + this._parent = null; + } + } + TreeNode.prototype.addChild = function(child) { + child._parent = this; + }; + TreeNode.prototype.remove = function() { + this._parent = null; + }; + Object.defineProperty(TreeNode.prototype, "parent", { + get: function() { + return this._parent; + }, + enumerable: true, + configurable: true + }); + return TreeNode; + })(); + exports.TreeNode = TreeNode; + var DirectiveDependency = (function(_super) { + __extends(DirectiveDependency, _super); + function DirectiveDependency(key, optional, lowerBoundVisibility, upperBoundVisibility, properties, attributeName, queryDecorator) { + _super.call(this, key, optional, lowerBoundVisibility, upperBoundVisibility, properties); + this.attributeName = attributeName; + this.queryDecorator = queryDecorator; + this._verify(); + } + DirectiveDependency.prototype._verify = function() { + var count = 0; + if (lang_1.isPresent(this.queryDecorator)) + count++; + if (lang_1.isPresent(this.attributeName)) + count++; + if (count > 1) + throw new exceptions_1.BaseException('A directive injectable can contain only one of the following @Attribute or @Query.'); + }; + DirectiveDependency.createFrom = function(d) { + return new DirectiveDependency(d.key, d.optional, d.lowerBoundVisibility, d.upperBoundVisibility, d.properties, DirectiveDependency._attributeName(d.properties), DirectiveDependency._query(d.properties)); + }; + DirectiveDependency._attributeName = function(properties) { + var p = collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.AttributeMetadata; + }); + return lang_1.isPresent(p) ? p.attributeName : null; + }; + DirectiveDependency._query = function(properties) { + return collection_1.ListWrapper.find(properties, function(p) { + return p instanceof di_2.QueryMetadata; + }); + }; + return DirectiveDependency; + })(di_1.Dependency); + exports.DirectiveDependency = DirectiveDependency; + var DirectiveBinding = (function(_super) { + __extends(DirectiveBinding, _super); + function DirectiveBinding(key, factory, deps, metadata, bindings, viewBindings) { + _super.call(this, key, [new binding_1.ResolvedFactory(factory, deps)], false); + this.metadata = metadata; + this.bindings = bindings; + this.viewBindings = viewBindings; + } + Object.defineProperty(DirectiveBinding.prototype, "displayName", { + get: function() { + return this.key.displayName; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "callOnDestroy", { + get: function() { + return this.metadata.callOnDestroy; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "queries", { + get: function() { + if (lang_1.isBlank(this.metadata.queries)) + return []; + var res = []; + collection_1.StringMapWrapper.forEach(this.metadata.queries, function(meta, fieldName) { + var setter = reflection_1.reflector.setter(fieldName); + res.push(new QueryMetadataWithSetter(setter, meta)); + }); + return res; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DirectiveBinding.prototype, "eventEmitters", { + get: function() { + return lang_1.isPresent(this.metadata) && lang_1.isPresent(this.metadata.events) ? this.metadata.events : []; + }, + enumerable: true, + configurable: true + }); + DirectiveBinding.createFromBinding = function(binding, meta) { + if (lang_1.isBlank(meta)) { + meta = new directives_1.DirectiveMetadata(); + } + var rb = binding_1.resolveBinding(binding); + var rf = rb.resolvedFactories[0]; + var deps = rf.dependencies.map(DirectiveDependency.createFrom); + var token = binding.token; + var metadata = api_1.RenderDirectiveMetadata.create({ + id: lang_1.stringify(binding.token), + type: meta instanceof directives_1.ComponentMetadata ? api_1.RenderDirectiveMetadata.COMPONENT_TYPE : api_1.RenderDirectiveMetadata.DIRECTIVE_TYPE, + selector: meta.selector, + compileChildren: meta.compileChildren, + events: meta.events, + host: lang_1.isPresent(meta.host) ? collection_1.MapWrapper.createFromStringMap(meta.host) : null, + properties: meta.properties, + readAttributes: DirectiveBinding._readAttributes(deps), + queries: meta.queries, + callOnDestroy: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnDestroy, token), + callOnChanges: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnChanges, token), + callDoCheck: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.DoCheck, token), + callOnInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.OnInit, token), + callAfterContentInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentInit, token), + callAfterContentChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterContentChecked, token), + callAfterViewInit: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewInit, token), + callAfterViewChecked: directive_lifecycle_reflector_1.hasLifecycleHook(interfaces_1.LifecycleHooks.AfterViewChecked, token), + changeDetection: meta instanceof directives_1.ComponentMetadata ? meta.changeDetection : null, + exportAs: meta.exportAs + }); + var bindings = lang_1.isPresent(meta.bindings) ? meta.bindings : []; + var viewBindigs = meta instanceof directives_1.ComponentMetadata && lang_1.isPresent(meta.viewBindings) ? meta.viewBindings : []; + return new DirectiveBinding(rb.key, rf.factory, deps, metadata, bindings, viewBindigs); + }; + DirectiveBinding._readAttributes = function(deps) { + var readAttributes = []; + deps.forEach(function(dep) { + if (lang_1.isPresent(dep.attributeName)) { + readAttributes.push(dep.attributeName); + } + }); + return readAttributes; + }; + DirectiveBinding.createFromType = function(type, annotation) { + var binding = new di_1.Binding(type, {toClass: type}); + return DirectiveBinding.createFromBinding(binding, annotation); + }; + return DirectiveBinding; + })(di_1.ResolvedBinding); + exports.DirectiveBinding = DirectiveBinding; + var PreBuiltObjects = (function() { + function PreBuiltObjects(viewManager, view, elementRef, templateRef) { + this.viewManager = viewManager; + this.view = view; + this.elementRef = elementRef; + this.templateRef = templateRef; + } + return PreBuiltObjects; + })(); + exports.PreBuiltObjects = PreBuiltObjects; + var QueryMetadataWithSetter = (function() { + function QueryMetadataWithSetter(setter, metadata) { + this.setter = setter; + this.metadata = metadata; + } + return QueryMetadataWithSetter; + })(); + exports.QueryMetadataWithSetter = QueryMetadataWithSetter; + var EventEmitterAccessor = (function() { + function EventEmitterAccessor(eventName, getter) { + this.eventName = eventName; + this.getter = getter; + } + EventEmitterAccessor.prototype.subscribe = function(view, boundElementIndex, directive) { + var _this = this; + var eventEmitter = this.getter(directive); + return async_1.ObservableWrapper.subscribe(eventEmitter, function(eventObj) { + return view.triggerEventHandlers(_this.eventName, eventObj, boundElementIndex); + }); + }; + return EventEmitterAccessor; + })(); + exports.EventEmitterAccessor = EventEmitterAccessor; + function _createEventEmitterAccessors(bwv) { + var binding = bwv.binding; + if (!(binding instanceof DirectiveBinding)) + return []; + var db = binding; + return collection_1.ListWrapper.map(db.eventEmitters, function(eventConfig) { + var parsedEvent = event_config_1.EventConfig.parse(eventConfig); + return new EventEmitterAccessor(parsedEvent.eventName, reflection_1.reflector.getter(parsedEvent.fieldName)); + }); + } + var ProtoElementInjector = (function() { + function ProtoElementInjector(parent, index, bwv, distanceToParent, _firstBindingIsComponent, directiveVariableBindings) { + this.parent = parent; + this.index = index; + this.distanceToParent = distanceToParent; + this._firstBindingIsComponent = _firstBindingIsComponent; + this.directiveVariableBindings = directiveVariableBindings; + var length = bwv.length; + this.protoInjector = new injector_1.ProtoInjector(bwv); + this.eventEmitterAccessors = collection_1.ListWrapper.createFixedSize(length); + for (var i = 0; i < length; ++i) { + this.eventEmitterAccessors[i] = _createEventEmitterAccessors(bwv[i]); + } + } + ProtoElementInjector.create = function(parent, index, bindings, firstBindingIsComponent, distanceToParent, directiveVariableBindings) { + var bd = []; + ProtoElementInjector._createDirectiveBindingWithVisibility(bindings, bd, firstBindingIsComponent); + if (firstBindingIsComponent) { + ProtoElementInjector._createViewBindingsWithVisibility(bindings, bd); + } + ProtoElementInjector._createBindingsWithVisibility(bindings, bd); + return new ProtoElementInjector(parent, index, bd, distanceToParent, firstBindingIsComponent, directiveVariableBindings); + }; + ProtoElementInjector._createDirectiveBindingWithVisibility = function(dirBindings, bd, firstBindingIsComponent) { + dirBindings.forEach(function(dirBinding) { + bd.push(ProtoElementInjector._createBindingWithVisibility(firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + }); + }; + ProtoElementInjector._createBindingsWithVisibility = function(dirBindings, bd) { + var bindingsFromAllDirectives = []; + dirBindings.forEach(function(dirBinding) { + bindingsFromAllDirectives = collection_1.ListWrapper.concat(bindingsFromAllDirectives, dirBinding.bindings); + }); + var resolved = di_1.Injector.resolve(bindingsFromAllDirectives); + resolved.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Public)); + }); + }; + ProtoElementInjector._createBindingWithVisibility = function(firstBindingIsComponent, dirBinding, dirBindings, binding) { + var isComponent = firstBindingIsComponent && dirBindings[0] === dirBinding; + return new injector_1.BindingWithVisibility(binding, isComponent ? injector_1.Visibility.PublicAndPrivate : injector_1.Visibility.Public); + }; + ProtoElementInjector._createViewBindingsWithVisibility = function(dirBindings, bd) { + var resolvedViewBindings = di_1.Injector.resolve(dirBindings[0].viewBindings); + resolvedViewBindings.forEach(function(b) { + return bd.push(new injector_1.BindingWithVisibility(b, injector_1.Visibility.Private)); + }); + }; + ProtoElementInjector.prototype.instantiate = function(parent) { + return new ElementInjector(this, parent); + }; + ProtoElementInjector.prototype.directParent = function() { + return this.distanceToParent < 2 ? this.parent : null; + }; + Object.defineProperty(ProtoElementInjector.prototype, "hasBindings", { + get: function() { + return this.eventEmitterAccessors.length > 0; + }, + enumerable: true, + configurable: true + }); + ProtoElementInjector.prototype.getBindingAtIndex = function(index) { + return this.protoInjector.getBindingAtIndex(index); + }; + return ProtoElementInjector; + })(); + exports.ProtoElementInjector = ProtoElementInjector; + var _Context = (function() { + function _Context(element, componentElement, injector) { + this.element = element; + this.componentElement = componentElement; + this.injector = injector; + } + return _Context; + })(); + var ElementInjector = (function(_super) { + __extends(ElementInjector, _super); + function ElementInjector(_proto, parent) { + var _this = this; + _super.call(this, parent); + this._proto = _proto; + this._preBuiltObjects = null; + this._injector = new di_1.Injector(this._proto.protoInjector, null, this, function() { + return _this._debugContext(); + }); + var injectorStrategy = this._injector.internalStrategy; + this._strategy = injectorStrategy instanceof injector_1.InjectorInlineStrategy ? new ElementInjectorInlineStrategy(injectorStrategy, this) : new ElementInjectorDynamicStrategy(injectorStrategy, this); + this.hydrated = false; + this._buildQueries(); + } + ElementInjector.prototype.dehydrate = function() { + this.hydrated = false; + this._host = null; + this._preBuiltObjects = null; + this._strategy.callOnDestroy(); + this._strategy.dehydrate(); + this._clearQueryLists(); + }; + ElementInjector.prototype.hydrate = function(imperativelyCreatedInjector, host, preBuiltObjects) { + this._host = host; + this._preBuiltObjects = preBuiltObjects; + this._reattachInjectors(imperativelyCreatedInjector); + this._strategy.hydrate(); + this.hydrated = true; + }; + ElementInjector.prototype.updateLocalQueries = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype.updateLocalViewQueries = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) { + this._query0.update(); + this._query0.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) { + this._query1.update(); + this._query1.list.fireCallbacks(); + } + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) { + this._query2.update(); + this._query2.list.fireCallbacks(); + } + }; + ElementInjector.prototype._debugContext = function() { + var p = this._preBuiltObjects; + var index = p.elementRef.boundElementIndex - p.view.elementOffset; + var c = this._preBuiltObjects.view.getDebugContext(index, null); + return lang_1.isPresent(c) ? new _Context(c.element, c.componentElement, c.injector) : null; + }; + ElementInjector.prototype._reattachInjectors = function(imperativelyCreatedInjector) { + if (lang_1.isPresent(this._parent)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._parent._injector, false); + } else { + this._reattachInjector(this._injector, this._parent._injector, false); + } + } else if (lang_1.isPresent(this._host)) { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, false); + this._reattachInjector(imperativelyCreatedInjector, this._host._injector, true); + } else { + this._reattachInjector(this._injector, this._host._injector, true); + } + } else { + if (lang_1.isPresent(imperativelyCreatedInjector)) { + this._reattachInjector(this._injector, imperativelyCreatedInjector, true); + } + } + }; + ElementInjector.prototype._reattachInjector = function(injector, parentInjector, isBoundary) { + injector.internalStrategy.attach(parentInjector, isBoundary); + }; + ElementInjector.prototype.hasVariableBinding = function(name) { + var vb = this._proto.directiveVariableBindings; + return lang_1.isPresent(vb) && vb.has(name); + }; + ElementInjector.prototype.getVariableBinding = function(name) { + var index = this._proto.directiveVariableBindings.get(name); + return lang_1.isPresent(index) ? this.getDirectiveAtIndex(index) : this.getElementRef(); + }; + ElementInjector.prototype.get = function(token) { + return this._injector.get(token); + }; + ElementInjector.prototype.hasDirective = function(type) { + return lang_1.isPresent(this._injector.getOptional(type)); + }; + ElementInjector.prototype.getEventEmitterAccessors = function() { + return this._proto.eventEmitterAccessors; + }; + ElementInjector.prototype.getDirectiveVariableBindings = function() { + return this._proto.directiveVariableBindings; + }; + ElementInjector.prototype.getComponent = function() { + return this._strategy.getComponent(); + }; + ElementInjector.prototype.getInjector = function() { + return this._injector; + }; + ElementInjector.prototype.getElementRef = function() { + return this._preBuiltObjects.elementRef; + }; + ElementInjector.prototype.getViewContainerRef = function() { + return new view_container_ref_1.ViewContainerRef(this._preBuiltObjects.viewManager, this.getElementRef()); + }; + ElementInjector.prototype.getView = function() { + return this._preBuiltObjects.view; + }; + ElementInjector.prototype.directParent = function() { + return this._proto.distanceToParent < 2 ? this.parent : null; + }; + ElementInjector.prototype.isComponentKey = function(key) { + return this._strategy.isComponentKey(key); + }; + ElementInjector.prototype.getDependency = function(injector, binding, dep) { + var key = dep.key; + if (binding instanceof DirectiveBinding) { + var dirDep = dep; + var dirBin = binding; + var staticKeys = StaticKeys.instance(); + if (key.id === staticKeys.viewManagerId) + return this._preBuiltObjects.viewManager; + if (lang_1.isPresent(dirDep.attributeName)) + return this._buildAttribute(dirDep); + if (lang_1.isPresent(dirDep.queryDecorator)) + return this._findQuery(dirDep.queryDecorator).list; + if (dirDep.key.id === StaticKeys.instance().changeDetectorRefId) { + if (dirBin.metadata.type === api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } else { + return this._preBuiltObjects.view.changeDetector.ref; + } + } + if (dirDep.key.id === StaticKeys.instance().elementRefId) { + return this.getElementRef(); + } + if (dirDep.key.id === StaticKeys.instance().viewContainerId) { + return this.getViewContainerRef(); + } + if (dirDep.key.id === StaticKeys.instance().templateRefId) { + if (lang_1.isBlank(this._preBuiltObjects.templateRef)) { + if (dirDep.optional) { + return null; + } + throw new di_1.NoBindingError(null, dirDep.key); + } + return this._preBuiltObjects.templateRef; + } + } else if (binding instanceof pipe_binding_1.PipeBinding) { + if (dep.key.id === StaticKeys.instance().changeDetectorRefId) { + var componentView = this._preBuiltObjects.view.getNestedView(this._preBuiltObjects.elementRef.boundElementIndex); + return componentView.changeDetector.ref; + } + } + return injector_1.UNDEFINED; + }; + ElementInjector.prototype._buildAttribute = function(dep) { + var attributes = this._proto.attributes; + if (lang_1.isPresent(attributes) && attributes.has(dep.attributeName)) { + return attributes.get(dep.attributeName); + } else { + return null; + } + }; + ElementInjector.prototype._buildQueriesForDeps = function(deps) { + for (var i = 0; i < deps.length; i++) { + var dep = deps[i]; + if (lang_1.isPresent(dep.queryDecorator)) { + this._createQueryRef(null, null, dep.queryDecorator); + } + } + }; + ElementInjector.prototype._buildQueriesForDirective = function(dirIndex, meta) { + for (var i = 0; i < meta.length; i++) { + var m = meta[i]; + this._createQueryRef(dirIndex, m.setter, m.metadata); + } + }; + ElementInjector.prototype._createQueryRef = function(dirIndex, setter, query) { + var queryList = new query_list_1.QueryList(); + if (lang_1.isBlank(this._query0)) { + this._query0 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query1)) { + this._query1 = new QueryRef(dirIndex, setter, query, queryList, this); + } else if (lang_1.isBlank(this._query2)) { + this._query2 = new QueryRef(dirIndex, setter, query, queryList, this); + } else { + throw new QueryError(); + } + }; + ElementInjector.prototype.addDirectivesMatchingQuery = function(query, list) { + var templateRef = lang_1.isBlank(this._preBuiltObjects) ? null : this._preBuiltObjects.templateRef; + if (query.selector === template_ref_1.TemplateRef && lang_1.isPresent(templateRef)) { + list.push(templateRef); + } + this._strategy.addDirectivesMatchingQuery(query, list); + }; + ElementInjector.prototype._buildQueries = function() { + if (lang_1.isPresent(this._proto)) { + this._strategy.buildQueries(); + } + }; + ElementInjector.prototype._findQuery = function(query) { + if (lang_1.isPresent(this._query0) && this._query0.query === query) { + return this._query0; + } + if (lang_1.isPresent(this._query1) && this._query1.query === query) { + return this._query1; + } + if (lang_1.isPresent(this._query2) && this._query2.query === query) { + return this._query2; + } + throw new exceptions_1.BaseException("Cannot find query for directive " + query + "."); + }; + ElementInjector.prototype.link = function(parent) { + parent.addChild(this); + }; + ElementInjector.prototype.unlink = function() { + this.remove(); + }; + ElementInjector.prototype.getDirectiveAtIndex = function(index) { + return this._injector.getAt(index); + }; + ElementInjector.prototype.hasInstances = function() { + return this._proto.hasBindings && this.hydrated; + }; + ElementInjector.prototype.getHost = function() { + return this._host; + }; + ElementInjector.prototype.getBoundElementIndex = function() { + return this._proto.index; + }; + ElementInjector.prototype.getRootViewInjectors = function() { + if (!this.hydrated) + return []; + var view = this._preBuiltObjects.view; + var nestedView = view.getNestedView(view.elementOffset + this.getBoundElementIndex()); + return lang_1.isPresent(nestedView) ? nestedView.rootElementInjectors : []; + }; + ElementInjector.prototype._clearQueryLists = function() { + if (lang_1.isPresent(this._query0)) + this._query0.reset(); + if (lang_1.isPresent(this._query1)) + this._query1.reset(); + if (lang_1.isPresent(this._query2)) + this._query2.reset(); + }; + ElementInjector.prototype.afterViewChecked = function() { + this.updateLocalViewQueries(); + }; + ElementInjector.prototype.afterContentChecked = function() { + this.updateLocalQueries(); + }; + ElementInjector.prototype.traverseAndSetQueriesAsDirty = function() { + var inj = this; + while (lang_1.isPresent(inj)) { + inj._setQueriesAsDirty(); + inj = inj.parent; + } + }; + ElementInjector.prototype._setQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && !this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && !this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && !this._query2.isViewQuery) + this._query2.dirty = true; + if (lang_1.isPresent(this._host)) + this._host._setViewQueriesAsDirty(); + }; + ElementInjector.prototype._setViewQueriesAsDirty = function() { + if (lang_1.isPresent(this._query0) && this._query0.isViewQuery) + this._query0.dirty = true; + if (lang_1.isPresent(this._query1) && this._query1.isViewQuery) + this._query1.dirty = true; + if (lang_1.isPresent(this._query2) && this._query2.isViewQuery) + this._query2.dirty = true; + }; + return ElementInjector; + })(TreeNode); + exports.ElementInjector = ElementInjector; + var ElementInjectorInlineStrategy = (function() { + function ElementInjectorInlineStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorInlineStrategy.prototype.hydrate = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + i.resetConstructionCounter(); + if (p.binding0 instanceof DirectiveBinding && lang_1.isPresent(p.keyId0) && i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + if (p.binding1 instanceof DirectiveBinding && lang_1.isPresent(p.keyId1) && i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + if (p.binding2 instanceof DirectiveBinding && lang_1.isPresent(p.keyId2) && i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + if (p.binding3 instanceof DirectiveBinding && lang_1.isPresent(p.keyId3) && i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + if (p.binding4 instanceof DirectiveBinding && lang_1.isPresent(p.keyId4) && i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + if (p.binding5 instanceof DirectiveBinding && lang_1.isPresent(p.keyId5) && i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + if (p.binding6 instanceof DirectiveBinding && lang_1.isPresent(p.keyId6) && i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + if (p.binding7 instanceof DirectiveBinding && lang_1.isPresent(p.keyId7) && i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + if (p.binding8 instanceof DirectiveBinding && lang_1.isPresent(p.keyId8) && i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + if (p.binding9 instanceof DirectiveBinding && lang_1.isPresent(p.keyId9) && i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + }; + ElementInjectorInlineStrategy.prototype.dehydrate = function() { + var i = this.injectorStrategy; + i.obj0 = injector_1.UNDEFINED; + i.obj1 = injector_1.UNDEFINED; + i.obj2 = injector_1.UNDEFINED; + i.obj3 = injector_1.UNDEFINED; + i.obj4 = injector_1.UNDEFINED; + i.obj5 = injector_1.UNDEFINED; + i.obj6 = injector_1.UNDEFINED; + i.obj7 = injector_1.UNDEFINED; + i.obj8 = injector_1.UNDEFINED; + i.obj9 = injector_1.UNDEFINED; + }; + ElementInjectorInlineStrategy.prototype.callOnDestroy = function() { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (p.binding0 instanceof DirectiveBinding && p.binding0.callOnDestroy) { + i.obj0.onDestroy(); + } + if (p.binding1 instanceof DirectiveBinding && p.binding1.callOnDestroy) { + i.obj1.onDestroy(); + } + if (p.binding2 instanceof DirectiveBinding && p.binding2.callOnDestroy) { + i.obj2.onDestroy(); + } + if (p.binding3 instanceof DirectiveBinding && p.binding3.callOnDestroy) { + i.obj3.onDestroy(); + } + if (p.binding4 instanceof DirectiveBinding && p.binding4.callOnDestroy) { + i.obj4.onDestroy(); + } + if (p.binding5 instanceof DirectiveBinding && p.binding5.callOnDestroy) { + i.obj5.onDestroy(); + } + if (p.binding6 instanceof DirectiveBinding && p.binding6.callOnDestroy) { + i.obj6.onDestroy(); + } + if (p.binding7 instanceof DirectiveBinding && p.binding7.callOnDestroy) { + i.obj7.onDestroy(); + } + if (p.binding8 instanceof DirectiveBinding && p.binding8.callOnDestroy) { + i.obj8.onDestroy(); + } + if (p.binding9 instanceof DirectiveBinding && p.binding9.callOnDestroy) { + i.obj9.onDestroy(); + } + }; + ElementInjectorInlineStrategy.prototype.getComponent = function() { + return this.injectorStrategy.obj0; + }; + ElementInjectorInlineStrategy.prototype.isComponentKey = function(key) { + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === this.injectorStrategy.protoStrategy.keyId0; + }; + ElementInjectorInlineStrategy.prototype.buildQueries = function() { + var p = this.injectorStrategy.protoStrategy; + if (p.binding0 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding0.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(0, p.binding0.queries); + } + if (p.binding1 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding1.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(1, p.binding1.queries); + } + if (p.binding2 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding2.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(2, p.binding2.queries); + } + if (p.binding3 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding3.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(3, p.binding3.queries); + } + if (p.binding4 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding4.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(4, p.binding4.queries); + } + if (p.binding5 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding5.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(5, p.binding5.queries); + } + if (p.binding6 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding6.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(6, p.binding6.queries); + } + if (p.binding7 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding7.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(7, p.binding7.queries); + } + if (p.binding8 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding8.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(8, p.binding8.queries); + } + if (p.binding9 instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.binding9.resolvedFactories[0].dependencies); + this._ei._buildQueriesForDirective(9, p.binding9.queries); + } + }; + ElementInjectorInlineStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var i = this.injectorStrategy; + var p = i.protoStrategy; + if (lang_1.isPresent(p.binding0) && p.binding0.key.token === query.selector) { + if (i.obj0 === injector_1.UNDEFINED) + i.obj0 = i.instantiateBinding(p.binding0, p.visibility0); + list.push(i.obj0); + } + if (lang_1.isPresent(p.binding1) && p.binding1.key.token === query.selector) { + if (i.obj1 === injector_1.UNDEFINED) + i.obj1 = i.instantiateBinding(p.binding1, p.visibility1); + list.push(i.obj1); + } + if (lang_1.isPresent(p.binding2) && p.binding2.key.token === query.selector) { + if (i.obj2 === injector_1.UNDEFINED) + i.obj2 = i.instantiateBinding(p.binding2, p.visibility2); + list.push(i.obj2); + } + if (lang_1.isPresent(p.binding3) && p.binding3.key.token === query.selector) { + if (i.obj3 === injector_1.UNDEFINED) + i.obj3 = i.instantiateBinding(p.binding3, p.visibility3); + list.push(i.obj3); + } + if (lang_1.isPresent(p.binding4) && p.binding4.key.token === query.selector) { + if (i.obj4 === injector_1.UNDEFINED) + i.obj4 = i.instantiateBinding(p.binding4, p.visibility4); + list.push(i.obj4); + } + if (lang_1.isPresent(p.binding5) && p.binding5.key.token === query.selector) { + if (i.obj5 === injector_1.UNDEFINED) + i.obj5 = i.instantiateBinding(p.binding5, p.visibility5); + list.push(i.obj5); + } + if (lang_1.isPresent(p.binding6) && p.binding6.key.token === query.selector) { + if (i.obj6 === injector_1.UNDEFINED) + i.obj6 = i.instantiateBinding(p.binding6, p.visibility6); + list.push(i.obj6); + } + if (lang_1.isPresent(p.binding7) && p.binding7.key.token === query.selector) { + if (i.obj7 === injector_1.UNDEFINED) + i.obj7 = i.instantiateBinding(p.binding7, p.visibility7); + list.push(i.obj7); + } + if (lang_1.isPresent(p.binding8) && p.binding8.key.token === query.selector) { + if (i.obj8 === injector_1.UNDEFINED) + i.obj8 = i.instantiateBinding(p.binding8, p.visibility8); + list.push(i.obj8); + } + if (lang_1.isPresent(p.binding9) && p.binding9.key.token === query.selector) { + if (i.obj9 === injector_1.UNDEFINED) + i.obj9 = i.instantiateBinding(p.binding9, p.visibility9); + list.push(i.obj9); + } + }; + return ElementInjectorInlineStrategy; + })(); + var ElementInjectorDynamicStrategy = (function() { + function ElementInjectorDynamicStrategy(injectorStrategy, _ei) { + this.injectorStrategy = injectorStrategy; + this._ei = _ei; + } + ElementInjectorDynamicStrategy.prototype.hydrate = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + inj.resetConstructionCounter(); + for (var i = 0; i < p.keyIds.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && lang_1.isPresent(p.keyIds[i]) && inj.objs[i] === injector_1.UNDEFINED) { + inj.objs[i] = inj.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + } + }; + ElementInjectorDynamicStrategy.prototype.dehydrate = function() { + var inj = this.injectorStrategy; + collection_1.ListWrapper.fill(inj.objs, injector_1.UNDEFINED); + }; + ElementInjectorDynamicStrategy.prototype.callOnDestroy = function() { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding && p.bindings[i].callOnDestroy) { + ist.objs[i].onDestroy(); + } + } + }; + ElementInjectorDynamicStrategy.prototype.getComponent = function() { + return this.injectorStrategy.objs[0]; + }; + ElementInjectorDynamicStrategy.prototype.isComponentKey = function(key) { + var p = this.injectorStrategy.protoStrategy; + return this._ei._proto._firstBindingIsComponent && lang_1.isPresent(key) && key.id === p.keyIds[0]; + }; + ElementInjectorDynamicStrategy.prototype.buildQueries = function() { + var inj = this.injectorStrategy; + var p = inj.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i] instanceof DirectiveBinding) { + this._ei._buildQueriesForDeps(p.bindings[i].resolvedFactory.dependencies); + this._ei._buildQueriesForDirective(i, p.bindings[i].queries); + } + } + }; + ElementInjectorDynamicStrategy.prototype.addDirectivesMatchingQuery = function(query, list) { + var ist = this.injectorStrategy; + var p = ist.protoStrategy; + for (var i = 0; i < p.bindings.length; i++) { + if (p.bindings[i].key.token === query.selector) { + if (ist.objs[i] === injector_1.UNDEFINED) { + ist.objs[i] = ist.instantiateBinding(p.bindings[i], p.visibilities[i]); + } + list.push(ist.objs[i]); + } + } + }; + return ElementInjectorDynamicStrategy; + })(); + var QueryError = (function(_super) { + __extends(QueryError, _super); + function QueryError() { + _super.call(this); + this.message = 'Only 3 queries can be concurrently active on an element.'; + } + QueryError.prototype.toString = function() { + return this.message; + }; + return QueryError; + })(exceptions_1.BaseException); + exports.QueryError = QueryError; + var QueryRef = (function() { + function QueryRef(dirIndex, setter, query, list, originator, dirty) { + if (dirty === void 0) { + dirty = true; + } + this.dirIndex = dirIndex; + this.setter = setter; + this.query = query; + this.list = list; + this.originator = originator; + this.dirty = dirty; + } + Object.defineProperty(QueryRef.prototype, "isViewQuery", { + get: function() { + return this.query.isViewQuery; + }, + enumerable: true, + configurable: true + }); + QueryRef.prototype.update = function() { + if (!this.dirty) + return ; + this._update(); + this.dirty = false; + if (lang_1.isPresent(this.dirIndex)) { + var dir = this.originator.getDirectiveAtIndex(this.dirIndex); + if (this.query.first) { + this.setter(dir, this.list.length > 0 ? this.list.first : null); + } else { + this.setter(dir, this.list); + } + } + }; + QueryRef.prototype._update = function() { + var aggregator = []; + if (this.query.isViewQuery) { + var view = this.originator.getView(); + var nestedView = view.getNestedView(view.elementOffset + this.originator.getBoundElementIndex()); + if (lang_1.isPresent(nestedView)) + this._visitView(nestedView, aggregator); + } else { + this._visit(this.originator, aggregator); + } + this.list.reset(aggregator); + }; + ; + QueryRef.prototype._visit = function(inj, aggregator) { + var view = inj.getView(); + var startIdx = view.elementOffset + inj._proto.index; + for (var i = startIdx; i < view.elementOffset + view.ownBindersCount; i++) { + var curInj = view.elementInjectors[i]; + if (lang_1.isBlank(curInj)) + continue; + if (i > startIdx && (lang_1.isBlank(curInj) || lang_1.isBlank(curInj.parent) || view.elementOffset + curInj.parent._proto.index < startIdx)) { + break; + } + if (!this.query.descendants && !(curInj.parent == this.originator || curInj == this.originator)) + continue; + this._visitInjector(curInj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._visitInjector = function(inj, aggregator) { + if (this.query.isVarBindingQuery) { + this._aggregateVariableBindings(inj, aggregator); + } else { + this._aggregateDirective(inj, aggregator); + } + }; + QueryRef.prototype._visitViewContainer = function(vc, aggregator) { + for (var j = 0; j < vc.views.length; j++) { + this._visitView(vc.views[j], aggregator); + } + }; + QueryRef.prototype._visitView = function(view, aggregator) { + for (var i = view.elementOffset; i < view.elementOffset + view.ownBindersCount; i++) { + var inj = view.elementInjectors[i]; + if (lang_1.isBlank(inj)) + continue; + this._visitInjector(inj, aggregator); + var vc = view.viewContainers[i]; + if (lang_1.isPresent(vc)) + this._visitViewContainer(vc, aggregator); + } + }; + QueryRef.prototype._aggregateVariableBindings = function(inj, aggregator) { + var vb = this.query.varBindings; + for (var i = 0; i < vb.length; ++i) { + if (inj.hasVariableBinding(vb[i])) { + aggregator.push(inj.getVariableBinding(vb[i])); + } + } + }; + QueryRef.prototype._aggregateDirective = function(inj, aggregator) { + inj.addDirectivesMatchingQuery(this.query, aggregator); + }; + QueryRef.prototype.reset = function() { + this.list.reset([]); + this.list.removeAllCallbacks(); + this.dirty = true; + }; + return QueryRef; + })(); + exports.QueryRef = QueryRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/compiler/compiler", ["angular2/src/compiler/template_compiler", "angular2/src/compiler/directive_metadata", "angular2/src/compiler/source_module", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/compiler/template_parser", "angular2/src/compiler/html_parser", "angular2/src/compiler/template_normalizer", "angular2/src/compiler/runtime_metadata", "angular2/src/compiler/change_detector_compiler", "angular2/src/compiler/style_compiler", "angular2/src/compiler/command_compiler", "angular2/src/compiler/template_compiler", "angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var template_compiler_1 = require("angular2/src/compiler/template_compiler"); + exports.TemplateCompiler = template_compiler_1.TemplateCompiler; + var directive_metadata_1 = require("angular2/src/compiler/directive_metadata"); + exports.CompileDirectiveMetadata = directive_metadata_1.CompileDirectiveMetadata; + exports.CompileTypeMetadata = directive_metadata_1.CompileTypeMetadata; + exports.CompileTemplateMetadata = directive_metadata_1.CompileTemplateMetadata; + var source_module_1 = require("angular2/src/compiler/source_module"); + exports.SourceModule = source_module_1.SourceModule; + exports.SourceWithImports = source_module_1.SourceWithImports; + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var template_parser_1 = require("angular2/src/compiler/template_parser"); + var html_parser_1 = require("angular2/src/compiler/html_parser"); + var template_normalizer_1 = require("angular2/src/compiler/template_normalizer"); + var runtime_metadata_1 = require("angular2/src/compiler/runtime_metadata"); + var change_detector_compiler_1 = require("angular2/src/compiler/change_detector_compiler"); + var style_compiler_1 = require("angular2/src/compiler/style_compiler"); + var command_compiler_1 = require("angular2/src/compiler/command_compiler"); + var template_compiler_2 = require("angular2/src/compiler/template_compiler"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + function compilerBindings() { + return [html_parser_1.HtmlParser, template_parser_1.TemplateParser, template_normalizer_1.TemplateNormalizer, runtime_metadata_1.RuntimeMetadataResolver, style_compiler_1.StyleCompiler, command_compiler_1.CommandCompiler, change_detector_compiler_1.ChangeDetectionCompiler, di_1.bind(change_detection_1.ChangeDetectorGenConfig).toValue(new change_detection_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true)), template_compiler_2.TemplateCompiler]; + } + exports.compilerBindings = compilerBindings; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/dom/dom_renderer", ["angular2/src/core/di", "angular2/src/animate/animation_builder", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/render/dom/events/event_manager", "angular2/src/core/render/dom/view/proto_view", "angular2/src/core/render/dom/view/view", "angular2/src/core/render/dom/view/fragment", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/util", "angular2/src/core/profile/profile", "angular2/src/core/render/api", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/dom/dom_tokens"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var animation_builder_1 = require("angular2/src/animate/animation_builder"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var event_manager_1 = require("angular2/src/core/render/dom/events/event_manager"); + var proto_view_1 = require("angular2/src/core/render/dom/view/proto_view"); + var view_1 = require("angular2/src/core/render/dom/view/view"); + var fragment_1 = require("angular2/src/core/render/dom/view/fragment"); + var shared_styles_host_1 = require("angular2/src/core/render/dom/view/shared_styles_host"); + var util_1 = require("angular2/src/core/render/dom/util"); + var profile_1 = require("angular2/src/core/profile/profile"); + var api_1 = require("angular2/src/core/render/api"); + var template_cloner_1 = require("angular2/src/core/render/dom/template_cloner"); + var dom_tokens_1 = require("angular2/src/core/render/dom/dom_tokens"); + var REFLECT_PREFIX = 'ng-reflect-'; + var DomRenderer = (function(_super) { + __extends(DomRenderer, _super); + function DomRenderer(_eventManager, _domSharedStylesHost, _animate, _templateCloner, document) { + _super.call(this); + this._eventManager = _eventManager; + this._domSharedStylesHost = _domSharedStylesHost; + this._animate = _animate; + this._templateCloner = _templateCloner; + this._createRootHostViewScope = profile_1.wtfCreateScope('DomRenderer#createRootHostView()'); + this._createViewScope = profile_1.wtfCreateScope('DomRenderer#createView()'); + this._detachFragmentScope = profile_1.wtfCreateScope('DomRenderer#detachFragment()'); + this._setEventDispatcherScope = profile_1.wtfCreateScope('DomRenderer#setEventDispatcher()'); + this._document = document; + } + DomRenderer.prototype.createRootHostView = function(hostProtoViewRef, fragmentCount, hostElementSelector) { + var s = this._createRootHostViewScope(); + var hostProtoView = proto_view_1.resolveInternalDomProtoView(hostProtoViewRef); + var element = dom_adapter_1.DOM.querySelector(this._document, hostElementSelector); + if (lang_1.isBlank(element)) { + profile_1.wtfLeave(s); + throw new exceptions_1.BaseException("The selector \"" + hostElementSelector + "\" did not match any elements"); + } + return profile_1.wtfLeave(s, this._createView(hostProtoView, element)); + }; + DomRenderer.prototype.createView = function(protoViewRef, fragmentCount) { + var s = this._createViewScope(); + var protoView = proto_view_1.resolveInternalDomProtoView(protoViewRef); + return profile_1.wtfLeave(s, this._createView(protoView, null)); + }; + DomRenderer.prototype.destroyView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + var elementBinders = view.proto.elementBinders; + for (var i = 0; i < elementBinders.length; i++) { + var binder = elementBinders[i]; + if (binder.hasNativeShadowRoot) { + this._domSharedStylesHost.removeHost(dom_adapter_1.DOM.getShadowRoot(view.boundElements[i])); + } + } + }; + DomRenderer.prototype.getNativeElementSync = function(location) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return null; + } + return view_1.resolveInternalDomView(location.renderView).boundElements[location.renderBoundElementIndex]; + }; + DomRenderer.prototype.getRootNodes = function(fragment) { + return fragment_1.resolveInternalDomFragment(fragment); + }; + DomRenderer.prototype.attachFragmentAfterFragment = function(previousFragmentRef, fragmentRef) { + var previousFragmentNodes = fragment_1.resolveInternalDomFragment(previousFragmentRef); + if (previousFragmentNodes.length > 0) { + var sibling = previousFragmentNodes[previousFragmentNodes.length - 1]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(sibling, nodes); + this.animateNodesEnter(nodes); + } + }; + DomRenderer.prototype.animateNodesEnter = function(nodes) { + for (var i = 0; i < nodes.length; i++) + this.animateNodeEnter(nodes[i]); + }; + DomRenderer.prototype.animateNodeEnter = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-enter'); + this._animate.css().addAnimationClass('ng-enter-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-enter'); + }); + } + }; + DomRenderer.prototype.animateNodeLeave = function(node) { + if (dom_adapter_1.DOM.isElementNode(node) && dom_adapter_1.DOM.hasClass(node, 'ng-animate')) { + dom_adapter_1.DOM.addClass(node, 'ng-leave'); + this._animate.css().addAnimationClass('ng-leave-active').start(node).onComplete(function() { + dom_adapter_1.DOM.removeClass(node, 'ng-leave'); + dom_adapter_1.DOM.remove(node); + }); + } else { + dom_adapter_1.DOM.remove(node); + } + }; + DomRenderer.prototype.attachFragmentAfterElement = function(elementRef, fragmentRef) { + if (lang_1.isBlank(elementRef.renderBoundElementIndex)) { + return ; + } + var parentView = view_1.resolveInternalDomView(elementRef.renderView); + var element = parentView.boundElements[elementRef.renderBoundElementIndex]; + var nodes = fragment_1.resolveInternalDomFragment(fragmentRef); + moveNodesAfterSibling(element, nodes); + this.animateNodesEnter(nodes); + }; + DomRenderer.prototype.detachFragment = function(fragmentRef) { + var s = this._detachFragmentScope(); + var fragmentNodes = fragment_1.resolveInternalDomFragment(fragmentRef); + for (var i = 0; i < fragmentNodes.length; i++) { + this.animateNodeLeave(fragmentNodes[i]); + } + profile_1.wtfLeave(s); + }; + DomRenderer.prototype.hydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + if (view.hydrated) + throw new exceptions_1.BaseException('The view is already hydrated.'); + view.hydrated = true; + view.eventHandlerRemovers = []; + var binders = view.proto.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + if (lang_1.isPresent(binder.globalEvents)) { + for (var i = 0; i < binder.globalEvents.length; i++) { + var globalEvent = binder.globalEvents[i]; + var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); + view.eventHandlerRemovers.push(remover); + } + } + } + }; + DomRenderer.prototype.dehydrateView = function(viewRef) { + var view = view_1.resolveInternalDomView(viewRef); + for (var i = 0; i < view.eventHandlerRemovers.length; i++) { + view.eventHandlerRemovers[i](); + } + view.eventHandlerRemovers = null; + view.hydrated = false; + }; + DomRenderer.prototype.setElementProperty = function(location, propertyName, propertyValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementProperty(location.renderBoundElementIndex, propertyName, propertyValue); + }; + DomRenderer.prototype.setElementAttribute = function(location, attributeName, attributeValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementAttribute(location.renderBoundElementIndex, attributeName, attributeValue); + }; + DomRenderer.prototype.setElementClass = function(location, className, isAdd) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementClass(location.renderBoundElementIndex, className, isAdd); + }; + DomRenderer.prototype.setElementStyle = function(location, styleName, styleValue) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.setElementStyle(location.renderBoundElementIndex, styleName, styleValue); + }; + DomRenderer.prototype.invokeElementMethod = function(location, methodName, args) { + if (lang_1.isBlank(location.renderBoundElementIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(location.renderView); + view.invokeElementMethod(location.renderBoundElementIndex, methodName, args); + }; + DomRenderer.prototype.setText = function(viewRef, textNodeIndex, text) { + if (lang_1.isBlank(textNodeIndex)) { + return ; + } + var view = view_1.resolveInternalDomView(viewRef); + dom_adapter_1.DOM.setText(view.boundTextNodes[textNodeIndex], text); + }; + DomRenderer.prototype.setEventDispatcher = function(viewRef, dispatcher) { + var s = this._setEventDispatcherScope(); + var view = view_1.resolveInternalDomView(viewRef); + view.eventDispatcher = dispatcher; + profile_1.wtfLeave(s); + }; + DomRenderer.prototype._createView = function(protoView, inplaceElement) { + var clonedProtoView = util_1.cloneAndQueryProtoView(this._templateCloner, protoView, true); + var boundElements = clonedProtoView.boundElements; + if (lang_1.isPresent(inplaceElement)) { + if (protoView.fragmentsRootNodeCount[0] !== 1) { + throw new exceptions_1.BaseException('Root proto views can only contain one element!'); + } + dom_adapter_1.DOM.clearNodes(inplaceElement); + var tempRoot = clonedProtoView.fragments[0][0]; + moveChildNodes(tempRoot, inplaceElement); + if (boundElements.length > 0 && boundElements[0] === tempRoot) { + boundElements[0] = inplaceElement; + } + clonedProtoView.fragments[0][0] = inplaceElement; + } + var view = new view_1.DomView(protoView, clonedProtoView.boundTextNodes, boundElements); + var binders = protoView.elementBinders; + for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { + var binder = binders[binderIdx]; + var element = boundElements[binderIdx]; + if (binder.hasNativeShadowRoot) { + var shadowRootWrapper = dom_adapter_1.DOM.firstChild(element); + var shadowRoot = dom_adapter_1.DOM.createShadowRoot(element); + this._domSharedStylesHost.addHost(shadowRoot); + moveChildNodes(shadowRootWrapper, shadowRoot); + dom_adapter_1.DOM.remove(shadowRootWrapper); + } + if (lang_1.isPresent(binder.eventLocals) && lang_1.isPresent(binder.localEvents)) { + for (var i = 0; i < binder.localEvents.length; i++) { + this._createEventListener(view, element, binderIdx, binder.localEvents[i].name, binder.eventLocals); + } + } + } + return new api_1.RenderViewWithFragments(new view_1.DomViewRef(view), clonedProtoView.fragments.map(function(nodes) { + return new fragment_1.DomFragmentRef(nodes); + })); + }; + DomRenderer.prototype._createEventListener = function(view, element, elementIndex, eventName, eventLocals) { + this._eventManager.addEventListener(element, eventName, function(event) { + view.dispatchEvent(elementIndex, eventName, event); + }); + }; + DomRenderer.prototype._createGlobalEventListener = function(view, elementIndex, eventName, eventTarget, fullName) { + return this._eventManager.addGlobalEventListener(eventTarget, eventName, function(event) { + view.dispatchEvent(elementIndex, fullName, event); + }); + }; + DomRenderer = __decorate([di_1.Injectable(), __param(4, di_1.Inject(dom_tokens_1.DOCUMENT)), __metadata('design:paramtypes', [event_manager_1.EventManager, shared_styles_host_1.DomSharedStylesHost, animation_builder_1.AnimationBuilder, template_cloner_1.TemplateCloner, Object])], DomRenderer); + return DomRenderer; + })(api_1.Renderer); + exports.DomRenderer = DomRenderer; + function moveNodesAfterSibling(sibling, nodes) { + if (nodes.length > 0 && lang_1.isPresent(dom_adapter_1.DOM.parentElement(sibling))) { + for (var i = 0; i < nodes.length; i++) { + dom_adapter_1.DOM.insertBefore(sibling, nodes[i]); + } + dom_adapter_1.DOM.insertBefore(nodes[nodes.length - 1], sibling); + } + } + function moveChildNodes(source, target) { + var currChild = dom_adapter_1.DOM.firstChild(source); + while (lang_1.isPresent(currChild)) { + var nextChild = dom_adapter_1.DOM.nextSibling(currChild); + dom_adapter_1.DOM.appendChild(target, currChild); + currChild = nextChild; + } + } + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/application_common", ["angular2/src/core/di", "angular2/src/core/forms", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/render/xhr", "angular2/src/web_workers/worker/xhr_impl", "angular2/src/core/services/app_root_url", "angular2/src/web_workers/worker/renderer", "angular2/src/core/render/api", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/web_workers/shared/message_bus", "angular2/src/core/application_ref", "angular2/src/web_workers/shared/serializer", "angular2/src/web_workers/shared/api", "angular2/src/web_workers/shared/render_proto_view_ref_store", "angular2/src/web_workers/shared/render_view_with_fragments_store", "angular2/src/core/facade/async", "angular2/src/web_workers/shared/messaging_api", "angular2/src/web_workers/worker/event_dispatcher"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/di"); + var forms_1 = require("angular2/src/core/forms"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var xhr_1 = require("angular2/src/core/render/xhr"); + var xhr_impl_1 = require("angular2/src/web_workers/worker/xhr_impl"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var renderer_1 = require("angular2/src/web_workers/worker/renderer"); + var api_1 = require("angular2/src/core/render/api"); + var client_message_broker_1 = require("angular2/src/web_workers/shared/client_message_broker"); + var message_bus_1 = require("angular2/src/web_workers/shared/message_bus"); + var application_ref_1 = require("angular2/src/core/application_ref"); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + var api_2 = require("angular2/src/web_workers/shared/api"); + var render_proto_view_ref_store_1 = require("angular2/src/web_workers/shared/render_proto_view_ref_store"); + var render_view_with_fragments_store_1 = require("angular2/src/web_workers/shared/render_view_with_fragments_store"); + var async_2 = require("angular2/src/core/facade/async"); + var messaging_api_1 = require("angular2/src/web_workers/shared/messaging_api"); + var event_dispatcher_1 = require("angular2/src/web_workers/worker/event_dispatcher"); + function platform(bindings) { + return application_ref_1.platformCommon(bindings); + } + exports.platform = platform; + var PrintLogger = (function() { + function PrintLogger() { + this.log = lang_1.print; + this.logError = lang_1.print; + this.logGroup = lang_1.print; + } + PrintLogger.prototype.logGroupEnd = function() {}; + return PrintLogger; + })(); + function webWorkerBindings(appComponentType, bus, initData) { + return [serializer_1.Serializer, di_1.bind(message_bus_1.MessageBus).toValue(bus), client_message_broker_1.ClientMessageBrokerFactory, renderer_1.WebWorkerRenderer, di_1.bind(api_1.Renderer).toAlias(renderer_1.WebWorkerRenderer), renderer_1.WebWorkerCompiler, di_1.bind(api_1.RenderCompiler).toAlias(renderer_1.WebWorkerCompiler), di_1.bind(api_2.ON_WEB_WORKER).toValue(true), render_view_with_fragments_store_1.RenderViewWithFragmentsStore, render_proto_view_ref_store_1.RenderProtoViewRefStore, di_1.bind(exceptions_1.ExceptionHandler).toFactory(function() { + return new exceptions_1.ExceptionHandler(new PrintLogger()); + }, []), xhr_impl_1.WebWorkerXHRImpl, di_1.bind(xhr_1.XHR).toAlias(xhr_impl_1.WebWorkerXHRImpl), di_1.bind(app_root_url_1.AppRootUrl).toValue(new app_root_url_1.AppRootUrl(initData['rootUrl'])), event_dispatcher_1.WebWorkerEventDispatcher, forms_1.FORM_BINDINGS]; + } + function bootstrapWebWorkerCommon(appComponentType, bus, appBindings) { + if (appBindings === void 0) { + appBindings = null; + } + var bootstrapProcess = async_1.PromiseWrapper.completer(); + var appPromise = platform().asyncApplication(function(zone) { + bus.attachToZone(zone); + bus.initChannel(messaging_api_1.SETUP_CHANNEL, false); + var subscription; + var emitter = bus.from(messaging_api_1.SETUP_CHANNEL); + subscription = async_2.ObservableWrapper.subscribe(emitter, function(message) { + var bindings = [application_ref_1.applicationCommonBindings(), webWorkerBindings(appComponentType, bus, message)]; + if (lang_1.isPresent(appBindings)) { + bindings.push(appBindings); + } + bootstrapProcess.resolve(bindings); + async_2.ObservableWrapper.dispose(subscription); + }); + async_2.ObservableWrapper.callNext(bus.to(messaging_api_1.SETUP_CHANNEL), "ready"); + return bootstrapProcess.promise; + }); + return async_1.PromiseWrapper.then(appPromise, function(app) { + return app.bootstrap(appComponentType); + }); + } + exports.bootstrapWebWorkerCommon = bootstrapWebWorkerCommon; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/di", ["angular2/src/core/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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/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 lang_1.StringWrapper.split(this.selector, new RegExp(",")); + }, + 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/change_detection", ["angular2/src/core/change_detection/jit_proto_change_detector", "angular2/src/core/change_detection/pregen_proto_change_detector", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/default_iterable_differ", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/differs/default_keyvalue_differ", "angular2/src/core/change_detection/interfaces", "angular2/src/core/di", "angular2/src/core/facade/collection", "angular2/src/core/facade/lang", "angular2/src/core/change_detection/parser/ast", "angular2/src/core/change_detection/parser/lexer", "angular2/src/core/change_detection/parser/parser", "angular2/src/core/change_detection/parser/locals", "angular2/src/core/change_detection/exceptions", "angular2/src/core/change_detection/interfaces", "angular2/src/core/change_detection/constants", "angular2/src/core/change_detection/proto_change_detector", "angular2/src/core/change_detection/binding_record", "angular2/src/core/change_detection/directive_record", "angular2/src/core/change_detection/dynamic_change_detector", "angular2/src/core/change_detection/change_detector_ref", "angular2/src/core/change_detection/differs/iterable_differs", "angular2/src/core/change_detection/differs/keyvalue_differs", "angular2/src/core/change_detection/change_detection_util"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var jit_proto_change_detector_1 = require("angular2/src/core/change_detection/jit_proto_change_detector"); + var pregen_proto_change_detector_1 = require("angular2/src/core/change_detection/pregen_proto_change_detector"); + var proto_change_detector_1 = require("angular2/src/core/change_detection/proto_change_detector"); + var iterable_differs_1 = require("angular2/src/core/change_detection/differs/iterable_differs"); + var default_iterable_differ_1 = require("angular2/src/core/change_detection/differs/default_iterable_differ"); + var keyvalue_differs_1 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + var default_keyvalue_differ_1 = require("angular2/src/core/change_detection/differs/default_keyvalue_differ"); + var interfaces_1 = require("angular2/src/core/change_detection/interfaces"); + var di_1 = require("angular2/src/core/di"); + var collection_1 = require("angular2/src/core/facade/collection"); + var lang_1 = require("angular2/src/core/facade/lang"); + var ast_1 = require("angular2/src/core/change_detection/parser/ast"); + exports.ASTWithSource = ast_1.ASTWithSource; + exports.AST = ast_1.AST; + exports.AstTransformer = ast_1.AstTransformer; + exports.PropertyRead = ast_1.PropertyRead; + exports.LiteralArray = ast_1.LiteralArray; + exports.ImplicitReceiver = ast_1.ImplicitReceiver; + var lexer_1 = require("angular2/src/core/change_detection/parser/lexer"); + exports.Lexer = lexer_1.Lexer; + var parser_1 = require("angular2/src/core/change_detection/parser/parser"); + exports.Parser = parser_1.Parser; + var locals_1 = require("angular2/src/core/change_detection/parser/locals"); + exports.Locals = locals_1.Locals; + var exceptions_1 = require("angular2/src/core/change_detection/exceptions"); + exports.DehydratedException = exceptions_1.DehydratedException; + exports.ExpressionChangedAfterItHasBeenCheckedException = exceptions_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = exceptions_1.ChangeDetectionError; + var interfaces_2 = require("angular2/src/core/change_detection/interfaces"); + exports.ChangeDetection = interfaces_2.ChangeDetection; + exports.ChangeDetectorDefinition = interfaces_2.ChangeDetectorDefinition; + exports.DebugContext = interfaces_2.DebugContext; + exports.ChangeDetectorGenConfig = interfaces_2.ChangeDetectorGenConfig; + var constants_1 = require("angular2/src/core/change_detection/constants"); + exports.ChangeDetectionStrategy = constants_1.ChangeDetectionStrategy; + exports.CHANGE_DECTION_STRATEGY_VALUES = constants_1.CHANGE_DECTION_STRATEGY_VALUES; + var proto_change_detector_2 = require("angular2/src/core/change_detection/proto_change_detector"); + exports.DynamicProtoChangeDetector = proto_change_detector_2.DynamicProtoChangeDetector; + var binding_record_1 = require("angular2/src/core/change_detection/binding_record"); + exports.BindingRecord = binding_record_1.BindingRecord; + exports.BindingTarget = binding_record_1.BindingTarget; + var directive_record_1 = require("angular2/src/core/change_detection/directive_record"); + exports.DirectiveIndex = directive_record_1.DirectiveIndex; + exports.DirectiveRecord = directive_record_1.DirectiveRecord; + var dynamic_change_detector_1 = require("angular2/src/core/change_detection/dynamic_change_detector"); + exports.DynamicChangeDetector = dynamic_change_detector_1.DynamicChangeDetector; + var change_detector_ref_1 = require("angular2/src/core/change_detection/change_detector_ref"); + exports.ChangeDetectorRef = change_detector_ref_1.ChangeDetectorRef; + var iterable_differs_2 = require("angular2/src/core/change_detection/differs/iterable_differs"); + exports.IterableDiffers = iterable_differs_2.IterableDiffers; + var keyvalue_differs_2 = require("angular2/src/core/change_detection/differs/keyvalue_differs"); + exports.KeyValueDiffers = keyvalue_differs_2.KeyValueDiffers; + var change_detection_util_1 = require("angular2/src/core/change_detection/change_detection_util"); + exports.WrappedValue = change_detection_util_1.WrappedValue; + exports.keyValDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_keyvalue_differ_1.DefaultKeyValueDifferFactory())]); + exports.iterableDiff = lang_1.CONST_EXPR([lang_1.CONST_EXPR(new default_iterable_differ_1.DefaultIterableDifferFactory())]); + exports.defaultIterableDiffers = lang_1.CONST_EXPR(new iterable_differs_1.IterableDiffers(exports.iterableDiff)); + exports.defaultKeyValueDiffers = lang_1.CONST_EXPR(new keyvalue_differs_1.KeyValueDiffers(exports.keyValDiff)); + exports.preGeneratedProtoDetectors = {}; + var PreGeneratedChangeDetection = (function(_super) { + __extends(PreGeneratedChangeDetection, _super); + function PreGeneratedChangeDetection(config, protoChangeDetectorsForTest) { + _super.call(this); + this._dynamicChangeDetection = new DynamicChangeDetection(); + this._protoChangeDetectorFactories = lang_1.isPresent(protoChangeDetectorsForTest) ? protoChangeDetectorsForTest : exports.preGeneratedProtoDetectors; + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + PreGeneratedChangeDetection.isSupported = function() { + return pregen_proto_change_detector_1.PregenProtoChangeDetector.isSupported(); + }; + PreGeneratedChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + if (collection_1.StringMapWrapper.contains(this._protoChangeDetectorFactories, id)) { + return collection_1.StringMapWrapper.get(this._protoChangeDetectorFactories, id)(definition); + } + return this._dynamicChangeDetection.getProtoChangeDetector(id, definition); + }; + Object.defineProperty(PreGeneratedChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(PreGeneratedChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + PreGeneratedChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig, Object])], PreGeneratedChangeDetection); + return PreGeneratedChangeDetection; + })(interfaces_1.ChangeDetection); + exports.PreGeneratedChangeDetection = PreGeneratedChangeDetection; + var DynamicChangeDetection = (function(_super) { + __extends(DynamicChangeDetection, _super); + function DynamicChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, false); + } + DynamicChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new proto_change_detector_1.DynamicProtoChangeDetector(definition); + }; + Object.defineProperty(DynamicChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(DynamicChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + DynamicChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], DynamicChangeDetection); + return DynamicChangeDetection; + })(interfaces_1.ChangeDetection); + exports.DynamicChangeDetection = DynamicChangeDetection; + var JitChangeDetection = (function(_super) { + __extends(JitChangeDetection, _super); + function JitChangeDetection(config) { + _super.call(this); + this._genConfig = lang_1.isPresent(config) ? config : new interfaces_1.ChangeDetectorGenConfig(lang_1.assertionsEnabled(), lang_1.assertionsEnabled(), false, true); + } + JitChangeDetection.isSupported = function() { + return jit_proto_change_detector_1.JitProtoChangeDetector.isSupported(); + }; + JitChangeDetection.prototype.getProtoChangeDetector = function(id, definition) { + return new jit_proto_change_detector_1.JitProtoChangeDetector(definition); + }; + Object.defineProperty(JitChangeDetection.prototype, "genConfig", { + get: function() { + return this._genConfig; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(JitChangeDetection.prototype, "generateDetectors", { + get: function() { + return true; + }, + enumerable: true, + configurable: true + }); + JitChangeDetection = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [interfaces_1.ChangeDetectorGenConfig])], JitChangeDetection); + return JitChangeDetection; + })(interfaces_1.ChangeDetection); + exports.JitChangeDetection = JitChangeDetection; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes/async_pipe", ["angular2/src/core/facade/lang", "angular2/src/core/facade/async", "angular2/src/core/metadata", "angular2/src/core/di", "angular2/src/core/change_detection", "angular2/src/core/pipes/invalid_pipe_argument_exception"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var async_1 = require("angular2/src/core/facade/async"); + var metadata_1 = require("angular2/src/core/metadata"); + var di_1 = require("angular2/src/core/di"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var invalid_pipe_argument_exception_1 = require("angular2/src/core/pipes/invalid_pipe_argument_exception"); + var ObservableStrategy = (function() { + function ObservableStrategy() {} + ObservableStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async_1.ObservableWrapper.subscribe(async, updateLatestValue, function(e) { + throw e; + }); + }; + ObservableStrategy.prototype.dispose = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + ObservableStrategy.prototype.onDestroy = function(subscription) { + async_1.ObservableWrapper.dispose(subscription); + }; + return ObservableStrategy; + })(); + var PromiseStrategy = (function() { + function PromiseStrategy() {} + PromiseStrategy.prototype.createSubscription = function(async, updateLatestValue) { + return async.then(updateLatestValue); + }; + PromiseStrategy.prototype.dispose = function(subscription) {}; + PromiseStrategy.prototype.onDestroy = function(subscription) {}; + return PromiseStrategy; + })(); + var _promiseStrategy = new PromiseStrategy(); + var _observableStrategy = new ObservableStrategy(); + var AsyncPipe = (function() { + function AsyncPipe(_ref) { + this._ref = _ref; + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + this._strategy = null; + } + AsyncPipe.prototype.onDestroy = function() { + if (lang_1.isPresent(this._subscription)) { + this._dispose(); + } + }; + AsyncPipe.prototype.transform = function(obj, args) { + if (lang_1.isBlank(this._obj)) { + if (lang_1.isPresent(obj)) { + this._subscribe(obj); + } + return null; + } + if (obj !== this._obj) { + this._dispose(); + return this.transform(obj); + } + if (this._latestValue === this._latestReturnedValue) { + return this._latestReturnedValue; + } else { + this._latestReturnedValue = this._latestValue; + return change_detection_1.WrappedValue.wrap(this._latestValue); + } + }; + AsyncPipe.prototype._subscribe = function(obj) { + var _this = this; + this._obj = obj; + this._strategy = this._selectStrategy(obj); + this._subscription = this._strategy.createSubscription(obj, function(value) { + return _this._updateLatestValue(obj, value); + }); + }; + AsyncPipe.prototype._selectStrategy = function(obj) { + if (lang_1.isPromise(obj)) { + return _promiseStrategy; + } else if (async_1.ObservableWrapper.isObservable(obj)) { + return _observableStrategy; + } else { + throw new invalid_pipe_argument_exception_1.InvalidPipeArgumentException(AsyncPipe, obj); + } + }; + AsyncPipe.prototype._dispose = function() { + this._strategy.dispose(this._subscription); + this._latestValue = null; + this._latestReturnedValue = null; + this._subscription = null; + this._obj = null; + }; + AsyncPipe.prototype._updateLatestValue = function(async, value) { + if (async === this._obj) { + this._latestValue = value; + this._ref.markForCheck(); + } + }; + AsyncPipe = __decorate([metadata_1.Pipe({ + name: 'async', + pure: false + }), di_1.Injectable(), __metadata('design:paramtypes', [change_detection_1.ChangeDetectorRef])], AsyncPipe); + return AsyncPipe; + })(); + exports.AsyncPipe = AsyncPipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/compiler", ["angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade/lang", "angular2/src/core/facade/exceptions", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/view", "angular2/src/core/compiler/element_injector", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/services/url_resolver", "angular2/src/core/services/app_root_url", "angular2/src/core/profile/profile", "angular2/src/core/pipes/pipe_binding", "angular2/src/core/render/api"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + var __metadata = (this && this.__metadata) || function(k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(k, v); + }; + var __param = (this && this.__param) || function(paramIndex, decorator) { + return function(target, key) { + decorator(target, key, paramIndex); + }; + }; + var di_1 = require("angular2/src/core/di"); + var pipes_1 = require("angular2/src/core/pipes"); + var lang_1 = require("angular2/src/core/facade/lang"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var view_1 = require("angular2/src/core/compiler/view"); + var element_injector_1 = require("angular2/src/core/compiler/element_injector"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var app_root_url_1 = require("angular2/src/core/services/app_root_url"); + var profile_1 = require("angular2/src/core/profile/profile"); + var pipe_binding_1 = require("angular2/src/core/pipes/pipe_binding"); + var api_1 = require("angular2/src/core/render/api"); + var CompilerCache = (function() { + function CompilerCache() { + this._cache = new collection_1.Map(); + this._hostCache = new collection_1.Map(); + } + CompilerCache.prototype.set = function(component, protoView) { + this._cache.set(component, protoView); + }; + CompilerCache.prototype.get = function(component) { + var result = this._cache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.setHost = function(component, protoView) { + this._hostCache.set(component, protoView); + }; + CompilerCache.prototype.getHost = function(component) { + var result = this._hostCache.get(component); + return lang_1.normalizeBlank(result); + }; + CompilerCache.prototype.clear = function() { + this._cache.clear(); + this._hostCache.clear(); + }; + CompilerCache = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [])], CompilerCache); + return CompilerCache; + })(); + exports.CompilerCache = CompilerCache; + var Compiler = (function() { + function Compiler(_directiveResolver, _pipeResolver, _defaultPipes, _compilerCache, _viewResolver, _componentUrlMapper, _urlResolver, _render, _protoViewFactory, appUrl) { + this._directiveResolver = _directiveResolver; + this._pipeResolver = _pipeResolver; + this._compilerCache = _compilerCache; + this._viewResolver = _viewResolver; + this._componentUrlMapper = _componentUrlMapper; + this._urlResolver = _urlResolver; + this._render = _render; + this._protoViewFactory = _protoViewFactory; + this._compiling = new collection_1.Map(); + this._defaultPipes = _defaultPipes; + this._appUrl = appUrl.value; + } + Compiler.prototype._bindDirective = function(directiveTypeOrBinding) { + if (directiveTypeOrBinding instanceof element_injector_1.DirectiveBinding) { + return directiveTypeOrBinding; + } else if (directiveTypeOrBinding instanceof di_1.Binding) { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding.token); + return element_injector_1.DirectiveBinding.createFromBinding(directiveTypeOrBinding, annotation); + } else { + var annotation = this._directiveResolver.resolve(directiveTypeOrBinding); + return element_injector_1.DirectiveBinding.createFromType(directiveTypeOrBinding, annotation); + } + }; + Compiler.prototype._bindPipe = function(typeOrBinding) { + var meta = this._pipeResolver.resolve(typeOrBinding); + return pipe_binding_1.PipeBinding.createFromType(typeOrBinding, meta); + }; + Compiler.prototype.compileInHost = function(componentType) { + var _this = this; + var r = profile_1.wtfStartTimeRange('Compiler#compile()', lang_1.stringify(componentType)); + var hostAppProtoView = this._compilerCache.getHost(componentType); + var hostPvPromise; + if (lang_1.isPresent(hostAppProtoView)) { + hostPvPromise = async_1.PromiseWrapper.resolve(hostAppProtoView); + } else { + var componentBinding = this._bindDirective(componentType); + Compiler._assertTypeIsComponent(componentBinding); + var directiveMetadata = componentBinding.metadata; + hostPvPromise = this._render.compileHost(directiveMetadata).then(function(hostRenderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, hostRenderPv, [componentBinding], []); + return _this._compileNestedProtoViews(protoViews, componentType, new collection_1.Map()); + }).then(function(appProtoView) { + _this._compilerCache.setHost(componentType, appProtoView); + return appProtoView; + }); + } + return hostPvPromise.then(function(hostAppProtoView) { + profile_1.wtfEndTimeRange(r); + return hostAppProtoView.ref; + }); + }; + Compiler.prototype._compile = function(componentBinding, componentPath) { + var _this = this; + var component = componentBinding.key.token; + var protoView = this._compilerCache.get(component); + if (lang_1.isPresent(protoView)) { + return protoView; + } + var resultPromise = this._compiling.get(component); + if (lang_1.isPresent(resultPromise)) { + return resultPromise; + } + var view = this._viewResolver.resolve(component); + var directives = this._flattenDirectives(view); + for (var i = 0; i < directives.length; i++) { + if (!Compiler._isValidDirective(directives[i])) { + throw new exceptions_1.BaseException("Unexpected directive value '" + lang_1.stringify(directives[i]) + "' on the View of component '" + lang_1.stringify(component) + "'"); + } + } + var boundDirectives = this._removeDuplicatedDirectives(directives.map(function(directive) { + return _this._bindDirective(directive); + })); + var pipes = this._flattenPipes(view); + var boundPipes = pipes.map(function(pipe) { + return _this._bindPipe(pipe); + }); + var renderTemplate = this._buildRenderTemplate(component, view, boundDirectives); + resultPromise = this._render.compile(renderTemplate).then(function(renderPv) { + var protoViews = _this._protoViewFactory.createAppProtoViews(componentBinding, renderPv, boundDirectives, boundPipes); + return _this._compileNestedProtoViews(protoViews, component, componentPath); + }).then(function(appProtoView) { + _this._compilerCache.set(component, appProtoView); + collection_1.MapWrapper.delete(_this._compiling, component); + return appProtoView; + }); + this._compiling.set(component, resultPromise); + return resultPromise; + }; + Compiler.prototype._removeDuplicatedDirectives = function(directives) { + var directivesMap = new collection_1.Map(); + directives.forEach(function(dirBinding) { + directivesMap.set(dirBinding.key.id, dirBinding); + }); + return collection_1.MapWrapper.values(directivesMap); + }; + Compiler.prototype._compileNestedProtoViews = function(appProtoViews, componentType, componentPath) { + var _this = this; + var nestedPVPromises = []; + componentPath = collection_1.MapWrapper.clone(componentPath); + if (appProtoViews[0].type === api_1.ViewType.COMPONENT) { + componentPath.set(componentType, appProtoViews[0]); + } + appProtoViews.forEach(function(appProtoView) { + _this._collectComponentElementBinders(appProtoView).forEach(function(elementBinder) { + var nestedComponent = elementBinder.componentDirective; + var nestedComponentType = nestedComponent.key.token; + var elementBinderDone = function(nestedPv) { + elementBinder.nestedProtoView = nestedPv; + }; + if (componentPath.has(nestedComponentType)) { + if (appProtoView.isEmbeddedFragment) { + throw new exceptions_1.BaseException(" is used within the recursive path of " + lang_1.stringify(nestedComponentType)); + } else if (appProtoView.type === api_1.ViewType.COMPONENT) { + throw new exceptions_1.BaseException("Unconditional component cycle in " + lang_1.stringify(nestedComponentType)); + } else { + elementBinderDone(componentPath.get(nestedComponentType)); + } + } else { + var nestedCall = _this._compile(nestedComponent, componentPath); + if (lang_1.isPromise(nestedCall)) { + nestedPVPromises.push(nestedCall.then(elementBinderDone)); + } else { + elementBinderDone(nestedCall); + } + } + }); + }); + return async_1.PromiseWrapper.all(nestedPVPromises).then(function(_) { + return async_1.PromiseWrapper.all(appProtoViews.map(function(appProtoView) { + return _this._mergeProtoView(appProtoView); + })); + }).then(function(_) { + return appProtoViews[0]; + }); + }; + Compiler.prototype._mergeProtoView = function(appProtoView) { + if (appProtoView.type !== api_1.ViewType.HOST && appProtoView.type !== api_1.ViewType.EMBEDDED) { + return null; + } + return this._render.mergeProtoViewsRecursively(this._collectMergeRenderProtoViews(appProtoView)).then(function(mergeResult) { + appProtoView.mergeMapping = new view_1.AppProtoViewMergeMapping(mergeResult); + }); + }; + Compiler.prototype._collectMergeRenderProtoViews = function(appProtoView) { + var result = [appProtoView.render]; + for (var i = 0; i < appProtoView.elementBinders.length; i++) { + var binder = appProtoView.elementBinders[i]; + if (lang_1.isPresent(binder.nestedProtoView)) { + if (binder.hasStaticComponent() || (binder.hasEmbeddedProtoView() && binder.nestedProtoView.isEmbeddedFragment)) { + result.push(this._collectMergeRenderProtoViews(binder.nestedProtoView)); + } else { + result.push(null); + } + } + } + return result; + }; + Compiler.prototype._collectComponentElementBinders = function(appProtoView) { + var componentElementBinders = []; + appProtoView.elementBinders.forEach(function(elementBinder) { + if (lang_1.isPresent(elementBinder.componentDirective)) { + componentElementBinders.push(elementBinder); + } + }); + return componentElementBinders; + }; + Compiler.prototype._buildRenderTemplate = function(component, view, directives) { + var _this = this; + var componentUrl = this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component)); + var templateAbsUrl = null; + var styleAbsUrls = null; + if (lang_1.isPresent(view.templateUrl) && view.templateUrl.trim().length > 0) { + templateAbsUrl = this._urlResolver.resolve(componentUrl, view.templateUrl); + } else if (lang_1.isPresent(view.template)) { + templateAbsUrl = componentUrl; + } + if (lang_1.isPresent(view.styleUrls)) { + styleAbsUrls = collection_1.ListWrapper.map(view.styleUrls, function(url) { + return _this._urlResolver.resolve(componentUrl, url); + }); + } + return new api_1.ViewDefinition({ + componentId: lang_1.stringify(component), + templateAbsUrl: templateAbsUrl, + template: view.template, + styleAbsUrls: styleAbsUrls, + styles: view.styles, + directives: collection_1.ListWrapper.map(directives, function(directiveBinding) { + return directiveBinding.metadata; + }), + encapsulation: view.encapsulation + }); + }; + Compiler.prototype._flattenPipes = function(view) { + if (lang_1.isBlank(view.pipes)) + return this._defaultPipes; + var pipes = collection_1.ListWrapper.clone(this._defaultPipes); + this._flattenList(view.pipes, pipes); + return pipes; + }; + Compiler.prototype._flattenDirectives = function(view) { + if (lang_1.isBlank(view.directives)) + return []; + var directives = []; + this._flattenList(view.directives, directives); + return directives; + }; + Compiler.prototype._flattenList = function(tree, out) { + for (var i = 0; i < tree.length; i++) { + var item = di_1.resolveForwardRef(tree[i]); + if (lang_1.isArray(item)) { + this._flattenList(item, out); + } else { + out.push(item); + } + } + }; + Compiler._isValidDirective = function(value) { + return lang_1.isPresent(value) && (value instanceof lang_1.Type || value instanceof di_1.Binding); + }; + Compiler._assertTypeIsComponent = function(directiveBinding) { + if (directiveBinding.metadata.type !== api_1.RenderDirectiveMetadata.COMPONENT_TYPE) { + throw new exceptions_1.BaseException("Could not load '" + lang_1.stringify(directiveBinding.key.token) + "' because it is not a component."); + } + }; + Compiler = __decorate([di_1.Injectable(), __param(2, di_1.Inject(pipes_1.DEFAULT_PIPES_TOKEN)), __metadata('design:paramtypes', [directive_resolver_1.DirectiveResolver, pipe_resolver_1.PipeResolver, Array, CompilerCache, view_resolver_1.ViewResolver, component_url_mapper_1.ComponentUrlMapper, url_resolver_1.UrlResolver, api_1.RenderCompiler, proto_view_factory_1.ProtoViewFactory, app_root_url_1.AppRootUrl])], Compiler); + return Compiler; + })(); + exports.Compiler = Compiler; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/render/render", ["angular2/src/core/render/dom/compiler/view_loader", "angular2/src/core/render/dom/view/shared_styles_host", "angular2/src/core/render/dom/compiler/compiler", "angular2/src/core/render/dom/dom_renderer", "angular2/src/core/render/dom/dom_tokens", "angular2/src/core/render/dom/template_cloner", "angular2/src/core/render/api"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/src/core/render/dom/compiler/view_loader")); + __export(require("angular2/src/core/render/dom/view/shared_styles_host")); + __export(require("angular2/src/core/render/dom/compiler/compiler")); + __export(require("angular2/src/core/render/dom/dom_renderer")); + __export(require("angular2/src/core/render/dom/dom_tokens")); + __export(require("angular2/src/core/render/dom/template_cloner")); + __export(require("angular2/src/core/render/api")); + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/web_workers/worker/application", ["angular2/src/web_workers/shared/post_message_bus", "angular2/src/web_workers/worker/application_common", "angular2/src/web_workers/shared/message_bus"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + var post_message_bus_1 = require("angular2/src/web_workers/shared/post_message_bus"); + var application_common_1 = require("angular2/src/web_workers/worker/application_common"); + __export(require("angular2/src/web_workers/shared/message_bus")); + var _postMessage = postMessage; + function bootstrapWebWorker(appComponentType, componentInjectableBindings) { + if (componentInjectableBindings === void 0) { + componentInjectableBindings = null; + } + var sink = new post_message_bus_1.PostMessageBusSink({postMessage: function(message, transferrables) { + console.log("Sending", message); + _postMessage(message, transferrables); + }}); + var source = new post_message_bus_1.PostMessageBusSource(); + var bus = new post_message_bus_1.PostMessageBus(sink, source); + return application_common_1.bootstrapWebWorkerCommon(appComponentType, bus, componentInjectableBindings); + } + exports.bootstrapWebWorker = bootstrapWebWorker; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/change_detection", ["angular2/src/core/change_detection/change_detection"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + exports.ChangeDetectionStrategy = change_detection_1.ChangeDetectionStrategy; + exports.ExpressionChangedAfterItHasBeenCheckedException = change_detection_1.ExpressionChangedAfterItHasBeenCheckedException; + exports.ChangeDetectionError = change_detection_1.ChangeDetectionError; + exports.ChangeDetectorRef = change_detection_1.ChangeDetectorRef; + exports.WrappedValue = change_detection_1.WrappedValue; + exports.IterableDiffers = change_detection_1.IterableDiffers; + exports.KeyValueDiffers = change_detection_1.KeyValueDiffers; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/pipes", ["angular2/src/core/pipes/async_pipe", "angular2/src/core/pipes/date_pipe", "angular2/src/core/pipes/default_pipes", "angular2/src/core/pipes/json_pipe", "angular2/src/core/pipes/slice_pipe", "angular2/src/core/pipes/lowercase_pipe", "angular2/src/core/pipes/number_pipe", "angular2/src/core/pipes/uppercase_pipe"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var async_pipe_1 = require("angular2/src/core/pipes/async_pipe"); + exports.AsyncPipe = async_pipe_1.AsyncPipe; + var date_pipe_1 = require("angular2/src/core/pipes/date_pipe"); + exports.DatePipe = date_pipe_1.DatePipe; + var default_pipes_1 = require("angular2/src/core/pipes/default_pipes"); + exports.DEFAULT_PIPES = default_pipes_1.DEFAULT_PIPES; + exports.DEFAULT_PIPES_TOKEN = default_pipes_1.DEFAULT_PIPES_TOKEN; + var json_pipe_1 = require("angular2/src/core/pipes/json_pipe"); + exports.JsonPipe = json_pipe_1.JsonPipe; + var slice_pipe_1 = require("angular2/src/core/pipes/slice_pipe"); + exports.SlicePipe = slice_pipe_1.SlicePipe; + var lowercase_pipe_1 = require("angular2/src/core/pipes/lowercase_pipe"); + exports.LowerCasePipe = lowercase_pipe_1.LowerCasePipe; + var number_pipe_1 = require("angular2/src/core/pipes/number_pipe"); + exports.NumberPipe = number_pipe_1.NumberPipe; + exports.DecimalPipe = number_pipe_1.DecimalPipe; + exports.PercentPipe = number_pipe_1.PercentPipe; + exports.CurrencyPipe = number_pipe_1.CurrencyPipe; + var uppercase_pipe_1 = require("angular2/src/core/pipes/uppercase_pipe"); + exports.UpperCasePipe = uppercase_pipe_1.UpperCasePipe; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/compiler/dynamic_component_loader", ["angular2/src/core/di", "angular2/src/core/compiler/compiler", "angular2/src/core/facade/lang", "angular2/src/core/compiler/view_manager"], 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) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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 compiler_1 = require("angular2/src/core/compiler/compiler"); + var lang_1 = require("angular2/src/core/facade/lang"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var ComponentRef = (function() { + function ComponentRef(location, instance, componentType, injector, _dispose) { + this._dispose = _dispose; + this.location = location; + this.instance = instance; + this.componentType = componentType; + this.injector = injector; + } + Object.defineProperty(ComponentRef.prototype, "hostView", { + get: function() { + return this.location.parentView; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponentType", { + get: function() { + return this.componentType; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ComponentRef.prototype, "hostComponent", { + get: function() { + return this.instance; + }, + enumerable: true, + configurable: true + }); + ComponentRef.prototype.dispose = function() { + this._dispose(); + }; + return ComponentRef; + })(); + exports.ComponentRef = ComponentRef; + var DynamicComponentLoader = (function() { + function DynamicComponentLoader(_compiler, _viewManager) { + this._compiler = _compiler; + this._viewManager = _viewManager; + } + DynamicComponentLoader.prototype.loadAsRoot = function(type, overrideSelector, injector, onDispose) { + var _this = this; + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var hostViewRef = _this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + _this._viewManager.destroyRootHostView(hostViewRef); + if (lang_1.isPresent(onDispose)) { + onDispose(); + } + }; + return new ComponentRef(newLocation, component, type, injector, dispose); + }); + }; + DynamicComponentLoader.prototype.loadIntoLocation = function(type, hostLocation, anchorName, bindings) { + if (bindings === void 0) { + bindings = null; + } + return this.loadNextToLocation(type, this._viewManager.getNamedElementInComponentView(hostLocation, anchorName), bindings); + }; + DynamicComponentLoader.prototype.loadNextToLocation = function(type, location, bindings) { + var _this = this; + if (bindings === void 0) { + bindings = null; + } + return this._compiler.compileInHost(type).then(function(hostProtoViewRef) { + var viewContainer = _this._viewManager.getViewContainer(location); + var hostViewRef = viewContainer.createHostView(hostProtoViewRef, viewContainer.length, bindings); + var newLocation = _this._viewManager.getHostElement(hostViewRef); + var component = _this._viewManager.getComponent(newLocation); + var dispose = function() { + var index = viewContainer.indexOf(hostViewRef); + if (index !== -1) { + viewContainer.remove(index); + } + }; + return new ComponentRef(newLocation, component, type, null, dispose); + }); + }; + DynamicComponentLoader = __decorate([di_1.Injectable(), __metadata('design:paramtypes', [compiler_1.Compiler, view_manager_1.AppViewManager])], DynamicComponentLoader); + return DynamicComponentLoader; + })(); + exports.DynamicComponentLoader = DynamicComponentLoader; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata/directives", ["angular2/src/core/facade/lang", "angular2/src/core/di/metadata", "angular2/src/core/change_detection"], 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; + } + __.prototype = b.prototype; + d.prototype = new __(); + }; + var __decorate = (this && this.__decorate) || function(decorators, target, key, desc) { + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + return Reflect.decorate(decorators, target, key, desc); + switch (arguments.length) { + case 2: + return decorators.reduceRight(function(o, d) { + return (d && d(o)) || o; + }, target); + case 3: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key)), void 0; + }, void 0); + case 4: + return decorators.reduceRight(function(o, d) { + return (d && d(target, key, o)) || o; + }, desc); + } + }; + 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/core/facade/lang"); + var metadata_1 = require("angular2/src/core/di/metadata"); + var change_detection_1 = require("angular2/src/core/change_detection"); + var DirectiveMetadata = (function(_super) { + __extends(DirectiveMetadata, _super); + function DirectiveMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + bindings = _b.bindings, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + queries = _b.queries, + _c = _b.compileChildren, + compileChildren = _c === void 0 ? true : _c; + _super.call(this); + this.selector = selector; + this.properties = properties; + this.events = events; + this.host = host; + this.exportAs = exportAs; + this.moduleId = moduleId; + this.queries = queries; + this.compileChildren = compileChildren; + this.bindings = bindings; + } + DirectiveMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], DirectiveMetadata); + return DirectiveMetadata; + })(metadata_1.InjectableMetadata); + exports.DirectiveMetadata = DirectiveMetadata; + var ComponentMetadata = (function(_super) { + __extends(ComponentMetadata, _super); + function ComponentMetadata(_a) { + var _b = _a === void 0 ? {} : _a, + selector = _b.selector, + properties = _b.properties, + events = _b.events, + host = _b.host, + exportAs = _b.exportAs, + moduleId = _b.moduleId, + bindings = _b.bindings, + viewBindings = _b.viewBindings, + _c = _b.changeDetection, + changeDetection = _c === void 0 ? change_detection_1.ChangeDetectionStrategy.Default : _c, + queries = _b.queries, + _d = _b.compileChildren, + compileChildren = _d === void 0 ? true : _d; + _super.call(this, { + selector: selector, + properties: properties, + events: events, + host: host, + exportAs: exportAs, + moduleId: moduleId, + bindings: bindings, + queries: queries, + compileChildren: compileChildren + }); + this.changeDetection = changeDetection; + this.viewBindings = viewBindings; + } + ComponentMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], ComponentMetadata); + return ComponentMetadata; + })(DirectiveMetadata); + exports.ComponentMetadata = ComponentMetadata; + var PipeMetadata = (function(_super) { + __extends(PipeMetadata, _super); + function PipeMetadata(_a) { + var name = _a.name, + pure = _a.pure; + _super.call(this); + this.name = name; + this._pure = pure; + } + Object.defineProperty(PipeMetadata.prototype, "pure", { + get: function() { + return lang_1.isPresent(this._pure) ? this._pure : true; + }, + enumerable: true, + configurable: true + }); + PipeMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [Object])], PipeMetadata); + return PipeMetadata; + })(metadata_1.InjectableMetadata); + exports.PipeMetadata = PipeMetadata; + var PropertyMetadata = (function() { + function PropertyMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + PropertyMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], PropertyMetadata); + return PropertyMetadata; + })(); + exports.PropertyMetadata = PropertyMetadata; + var EventMetadata = (function() { + function EventMetadata(bindingPropertyName) { + this.bindingPropertyName = bindingPropertyName; + } + EventMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], EventMetadata); + return EventMetadata; + })(); + exports.EventMetadata = EventMetadata; + var HostBindingMetadata = (function() { + function HostBindingMetadata(hostPropertyName) { + this.hostPropertyName = hostPropertyName; + } + HostBindingMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String])], HostBindingMetadata); + return HostBindingMetadata; + })(); + exports.HostBindingMetadata = HostBindingMetadata; + var HostListenerMetadata = (function() { + function HostListenerMetadata(eventName, args) { + this.eventName = eventName; + this.args = args; + } + HostListenerMetadata = __decorate([lang_1.CONST(), __metadata('design:paramtypes', [String, Array])], HostListenerMetadata); + return HostListenerMetadata; + })(); + exports.HostListenerMetadata = HostListenerMetadata; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/application_ref", ["angular2/src/core/zone/ng_zone", "angular2/src/core/facade/lang", "angular2/src/core/di", "angular2/src/core/application_tokens", "angular2/src/core/facade/async", "angular2/src/core/facade/collection", "angular2/src/core/reflection/reflection", "angular2/src/core/testability/testability", "angular2/src/core/compiler/dynamic_component_loader", "angular2/src/core/facade/exceptions", "angular2/src/core/dom/dom_adapter", "angular2/src/core/compiler/view_ref", "angular2/src/core/life_cycle/life_cycle", "angular2/src/core/compiler/proto_view_factory", "angular2/src/core/change_detection/change_detection", "angular2/src/core/compiler/view_pool", "angular2/src/core/compiler/view_manager", "angular2/src/core/compiler/view_manager_utils", "angular2/src/core/compiler/view_listener", "angular2/src/core/compiler/compiler", "angular2/src/core/pipes", "angular2/src/core/compiler/view_resolver", "angular2/src/core/compiler/directive_resolver", "angular2/src/core/compiler/pipe_resolver", "angular2/src/core/render/dom/compiler/style_url_resolver", "angular2/src/core/services/url_resolver", "angular2/src/core/compiler/component_url_mapper", "angular2/src/compiler/compiler"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var ng_zone_1 = require("angular2/src/core/zone/ng_zone"); + var lang_1 = require("angular2/src/core/facade/lang"); + var di_1 = require("angular2/src/core/di"); + var application_tokens_1 = require("angular2/src/core/application_tokens"); + var async_1 = require("angular2/src/core/facade/async"); + var collection_1 = require("angular2/src/core/facade/collection"); + var reflection_1 = require("angular2/src/core/reflection/reflection"); + var testability_1 = require("angular2/src/core/testability/testability"); + var dynamic_component_loader_1 = require("angular2/src/core/compiler/dynamic_component_loader"); + var exceptions_1 = require("angular2/src/core/facade/exceptions"); + var dom_adapter_1 = require("angular2/src/core/dom/dom_adapter"); + var view_ref_1 = require("angular2/src/core/compiler/view_ref"); + var life_cycle_1 = require("angular2/src/core/life_cycle/life_cycle"); + var proto_view_factory_1 = require("angular2/src/core/compiler/proto_view_factory"); + var change_detection_1 = require("angular2/src/core/change_detection/change_detection"); + var view_pool_1 = require("angular2/src/core/compiler/view_pool"); + var view_manager_1 = require("angular2/src/core/compiler/view_manager"); + var view_manager_utils_1 = require("angular2/src/core/compiler/view_manager_utils"); + var view_listener_1 = require("angular2/src/core/compiler/view_listener"); + var compiler_1 = require("angular2/src/core/compiler/compiler"); + var pipes_1 = require("angular2/src/core/pipes"); + var view_resolver_1 = require("angular2/src/core/compiler/view_resolver"); + var directive_resolver_1 = require("angular2/src/core/compiler/directive_resolver"); + var pipe_resolver_1 = require("angular2/src/core/compiler/pipe_resolver"); + var style_url_resolver_1 = require("angular2/src/core/render/dom/compiler/style_url_resolver"); + var url_resolver_1 = require("angular2/src/core/services/url_resolver"); + var component_url_mapper_1 = require("angular2/src/core/compiler/component_url_mapper"); + var compiler_2 = require("angular2/src/compiler/compiler"); + function platformBindings() { + return [di_1.bind(reflection_1.Reflector).toValue(reflection_1.reflector), testability_1.TestabilityRegistry]; + } + exports.platformBindings = platformBindings; + function _componentBindings(appComponentType) { + return [di_1.bind(application_tokens_1.APP_COMPONENT).toValue(appComponentType), di_1.bind(application_tokens_1.APP_COMPONENT_REF_PROMISE).toFactory(function(dynamicComponentLoader, injector) { + return dynamicComponentLoader.loadAsRoot(appComponentType, null, injector).then(function(componentRef) { + if (lang_1.isPresent(componentRef.location.nativeElement)) { + injector.get(testability_1.TestabilityRegistry).registerApplication(componentRef.location.nativeElement, injector.get(testability_1.Testability)); + } + return componentRef; + }); + }, [dynamic_component_loader_1.DynamicComponentLoader, di_1.Injector]), di_1.bind(appComponentType).toFactory(function(p) { + return p.then(function(ref) { + return ref.instance; + }); + }, [application_tokens_1.APP_COMPONENT_REF_PROMISE])]; + } + function applicationCommonBindings() { + var bestChangeDetection = new change_detection_1.DynamicChangeDetection(); + if (change_detection_1.PreGeneratedChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.PreGeneratedChangeDetection(); + } else if (change_detection_1.JitChangeDetection.isSupported()) { + bestChangeDetection = new change_detection_1.JitChangeDetection(); + } + return [compiler_2.compilerBindings(), proto_view_factory_1.ProtoViewFactory, view_pool_1.AppViewPool, di_1.bind(view_pool_1.APP_VIEW_POOL_CAPACITY).toValue(10000), view_manager_1.AppViewManager, view_manager_utils_1.AppViewManagerUtils, view_listener_1.AppViewListener, compiler_1.Compiler, compiler_1.CompilerCache, view_resolver_1.ViewResolver, pipes_1.DEFAULT_PIPES, di_1.bind(change_detection_1.IterableDiffers).toValue(change_detection_1.defaultIterableDiffers), di_1.bind(change_detection_1.KeyValueDiffers).toValue(change_detection_1.defaultKeyValueDiffers), di_1.bind(change_detection_1.ChangeDetection).toValue(bestChangeDetection), directive_resolver_1.DirectiveResolver, url_resolver_1.UrlResolver, style_url_resolver_1.StyleUrlResolver, pipe_resolver_1.PipeResolver, component_url_mapper_1.ComponentUrlMapper, change_detection_1.Parser, change_detection_1.Lexer, dynamic_component_loader_1.DynamicComponentLoader, di_1.bind(life_cycle_1.LifeCycle).toFactory(function(exceptionHandler) { + return new life_cycle_1.LifeCycle(null, lang_1.assertionsEnabled()); + }, [exceptions_1.ExceptionHandler])]; + } + exports.applicationCommonBindings = applicationCommonBindings; + function createNgZone() { + return new ng_zone_1.NgZone({enableLongStackTrace: lang_1.assertionsEnabled()}); + } + exports.createNgZone = createNgZone; + var _platform; + function platformCommon(bindings, initializer) { + if (lang_1.isPresent(_platform)) { + if (lang_1.isBlank(bindings)) { + return _platform; + } + throw "platform() can only be called once per page"; + } + if (lang_1.isPresent(initializer)) { + initializer(); + } + if (lang_1.isBlank(bindings)) { + bindings = platformBindings(); + } + _platform = new PlatformRef(di_1.Injector.resolveAndCreate(bindings), function() { + _platform = null; + }); + return _platform; + } + exports.platformCommon = platformCommon; + var PlatformRef = (function() { + function PlatformRef(_injector, _dispose) { + this._injector = _injector; + this._dispose = _dispose; + this._applications = []; + } + Object.defineProperty(PlatformRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + PlatformRef.prototype.application = function(bindings) { + var app = this._initApp(createNgZone(), bindings); + return app; + }; + PlatformRef.prototype.asyncApplication = function(bindingFn) { + var _this = this; + var zone = createNgZone(); + var completer = async_1.PromiseWrapper.completer(); + zone.run(function() { + async_1.PromiseWrapper.then(bindingFn(zone), function(bindings) { + completer.resolve(_this._initApp(zone, bindings)); + }); + }); + return completer.promise; + }; + PlatformRef.prototype._initApp = function(zone, bindings) { + var _this = this; + var injector; + zone.run(function() { + bindings.push(di_1.bind(ng_zone_1.NgZone).toValue(zone)); + bindings.push(di_1.bind(ApplicationRef).toValue(_this)); + var exceptionHandler; + try { + injector = _this.injector.resolveAndCreateChild(bindings); + exceptionHandler = injector.get(exceptions_1.ExceptionHandler); + zone.overrideOnErrorHandler(function(e, s) { + return exceptionHandler.call(e, s); + }); + } catch (e) { + if (lang_1.isPresent(exceptionHandler)) { + exceptionHandler.call(e, e.stack); + } else { + dom_adapter_1.DOM.logError(e); + } + } + }); + var app = new ApplicationRef(this, zone, injector); + this._applications.push(app); + return app; + }; + PlatformRef.prototype.dispose = function() { + this._applications.forEach(function(app) { + return app.dispose(); + }); + this._dispose(); + }; + PlatformRef.prototype._applicationDisposed = function(app) { + collection_1.ListWrapper.remove(this._applications, app); + }; + return PlatformRef; + })(); + exports.PlatformRef = PlatformRef; + var ApplicationRef = (function() { + function ApplicationRef(_platform, _zone, _injector) { + this._platform = _platform; + this._zone = _zone; + this._injector = _injector; + this._bootstrapListeners = []; + this._rootComponents = []; + } + ApplicationRef.prototype.registerBootstrapListener = function(listener) { + this._bootstrapListeners.push(listener); + }; + ApplicationRef.prototype.bootstrap = function(componentType, bindings) { + var _this = this; + var completer = async_1.PromiseWrapper.completer(); + this._zone.run(function() { + var componentBindings = _componentBindings(componentType); + if (lang_1.isPresent(bindings)) { + componentBindings.push(bindings); + } + var exceptionHandler = _this._injector.get(exceptions_1.ExceptionHandler); + try { + var injector = _this._injector.resolveAndCreateChild(componentBindings); + var compRefToken = injector.get(application_tokens_1.APP_COMPONENT_REF_PROMISE); + var tick = function(componentRef) { + var appChangeDetector = view_ref_1.internalView(componentRef.hostView).changeDetector; + var lc = injector.get(life_cycle_1.LifeCycle); + lc.registerWith(_this._zone, appChangeDetector); + lc.tick(); + completer.resolve(componentRef); + _this._rootComponents.push(componentRef); + _this._bootstrapListeners.forEach(function(listener) { + return listener(componentRef); + }); + }; + var tickResult = async_1.PromiseWrapper.then(compRefToken, tick); + async_1.PromiseWrapper.then(tickResult, function(_) {}); + async_1.PromiseWrapper.then(tickResult, null, function(err, stackTrace) { + return completer.reject(err, stackTrace); + }); + } catch (e) { + exceptionHandler.call(e, e.stack); + completer.reject(e, e.stack); + } + }); + return completer.promise; + }; + Object.defineProperty(ApplicationRef.prototype, "injector", { + get: function() { + return this._injector; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ApplicationRef.prototype, "zone", { + get: function() { + return this._zone; + }, + enumerable: true, + configurable: true + }); + ApplicationRef.prototype.dispose = function() { + this._rootComponents.forEach(function(ref) { + return ref.dispose(); + }); + this._platform._applicationDisposed(this); + }; + return ApplicationRef; + })(); + exports.ApplicationRef = ApplicationRef; + global.define = __define; + return module.exports; +}); + +System.register("angular2/src/core/metadata", ["angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/metadata/di", "angular2/src/core/metadata/directives", "angular2/src/core/metadata/view", "angular2/src/core/util/decorators"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + var di_1 = require("angular2/src/core/metadata/di"); + exports.QueryMetadata = di_1.QueryMetadata; + exports.ContentChildrenMetadata = di_1.ContentChildrenMetadata; + exports.ContentChildMetadata = di_1.ContentChildMetadata; + exports.ViewChildrenMetadata = di_1.ViewChildrenMetadata; + exports.ViewQueryMetadata = di_1.ViewQueryMetadata; + exports.ViewChildMetadata = di_1.ViewChildMetadata; + exports.AttributeMetadata = di_1.AttributeMetadata; + var directives_1 = require("angular2/src/core/metadata/directives"); + exports.ComponentMetadata = directives_1.ComponentMetadata; + exports.DirectiveMetadata = directives_1.DirectiveMetadata; + exports.PipeMetadata = directives_1.PipeMetadata; + exports.PropertyMetadata = directives_1.PropertyMetadata; + exports.EventMetadata = directives_1.EventMetadata; + exports.HostBindingMetadata = directives_1.HostBindingMetadata; + exports.HostListenerMetadata = directives_1.HostListenerMetadata; + var view_1 = require("angular2/src/core/metadata/view"); + exports.ViewMetadata = view_1.ViewMetadata; + exports.ViewEncapsulation = view_1.ViewEncapsulation; + var di_2 = require("angular2/src/core/metadata/di"); + var directives_2 = require("angular2/src/core/metadata/directives"); + var view_2 = require("angular2/src/core/metadata/view"); + var decorators_1 = require("angular2/src/core/util/decorators"); + exports.Component = decorators_1.makeDecorator(directives_2.ComponentMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Directive = decorators_1.makeDecorator(directives_2.DirectiveMetadata); + exports.View = decorators_1.makeDecorator(view_2.ViewMetadata, function(fn) { + return fn.View = exports.View; + }); + exports.Attribute = decorators_1.makeParamDecorator(di_2.AttributeMetadata); + exports.Query = decorators_1.makeParamDecorator(di_2.QueryMetadata); + exports.ContentChildren = decorators_1.makePropDecorator(di_2.ContentChildrenMetadata); + exports.ContentChild = decorators_1.makePropDecorator(di_2.ContentChildMetadata); + exports.ViewChildren = decorators_1.makePropDecorator(di_2.ViewChildrenMetadata); + exports.ViewChild = decorators_1.makePropDecorator(di_2.ViewChildMetadata); + exports.ViewQuery = decorators_1.makeParamDecorator(di_2.ViewQueryMetadata); + exports.Pipe = decorators_1.makeDecorator(directives_2.PipeMetadata); + exports.Property = decorators_1.makePropDecorator(directives_2.PropertyMetadata); + exports.Event = decorators_1.makePropDecorator(directives_2.EventMetadata); + exports.HostBinding = decorators_1.makePropDecorator(directives_2.HostBindingMetadata); + exports.HostListener = decorators_1.makePropDecorator(directives_2.HostListenerMetadata); + global.define = __define; + return module.exports; +}); + +System.register("angular2/web_worker/worker", ["angular2/lifecycle_hooks", "angular2/src/core/metadata", "angular2/src/core/util", "angular2/src/core/di", "angular2/src/core/pipes", "angular2/src/core/facade", "angular2/src/core/application_ref", "angular2/src/core/services", "angular2/src/core/compiler", "angular2/src/core/lifecycle", "angular2/src/core/zone", "angular2/src/core/render/render", "angular2/src/core/directives", "angular2/src/core/forms", "angular2/src/core/debug", "angular2/src/core/change_detection", "angular2/profile", "angular2/src/web_workers/worker/application", "angular2/src/web_workers/shared/client_message_broker", "angular2/src/web_workers/shared/service_message_broker", "angular2/src/web_workers/shared/serializer"], true, function(require, exports, module) { + var global = System.global, + __define = global.define; + global.define = undefined; + function __export(m) { + for (var p in m) + if (!exports.hasOwnProperty(p)) + exports[p] = m[p]; + } + __export(require("angular2/lifecycle_hooks")); + __export(require("angular2/src/core/metadata")); + __export(require("angular2/src/core/util")); + __export(require("angular2/src/core/di")); + __export(require("angular2/src/core/pipes")); + __export(require("angular2/src/core/facade")); + __export(require("angular2/src/core/application_ref")); + __export(require("angular2/src/core/services")); + __export(require("angular2/src/core/compiler")); + __export(require("angular2/src/core/lifecycle")); + __export(require("angular2/src/core/zone")); + var render_1 = require("angular2/src/core/render/render"); + exports.Renderer = render_1.Renderer; + exports.RenderViewRef = render_1.RenderViewRef; + exports.RenderProtoViewRef = render_1.RenderProtoViewRef; + exports.RenderFragmentRef = render_1.RenderFragmentRef; + exports.RenderViewWithFragments = render_1.RenderViewWithFragments; + __export(require("angular2/src/core/directives")); + __export(require("angular2/src/core/forms")); + __export(require("angular2/src/core/debug")); + __export(require("angular2/src/core/change_detection")); + __export(require("angular2/profile")); + __export(require("angular2/src/web_workers/worker/application")); + __export(require("angular2/src/web_workers/shared/client_message_broker")); + __export(require("angular2/src/web_workers/shared/service_message_broker")); + var serializer_1 = require("angular2/src/web_workers/shared/serializer"); + exports.PRIMITIVE = serializer_1.PRIMITIVE; + global.define = __define; + return module.exports; +}); + +//# sourceMappingURLDisabled=worker.dev.js.map \ No newline at end of file